-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDropIt.php
48 lines (39 loc) · 827 Bytes
/
DropIt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$text = $_GET['text'];
$minfont = $_GET['minFontSize'];
$maxfont = $_GET['maxFontSize'];
$step = $_GET['step'];
$fontSize = $minfont;
$up = true;
$textArray = str_split($text);
foreach($textArray as $key=>$char) {
echo "<span style='font-size:".$fontSize.";".if_even($char)."'>".htmlspecialchars($char)."</span>";
if (if_letter($char) && $up == true && $fontSize < $maxfont)
{
$fontSize += $step;
$up = true;
}
else
{
if(if_letter($char) && $fontSize > $minfont) {
$fontSize -= $step;
$up = false;
} elseif(if_letter($char)) {
$up = true;
$fontSize += $step;
}
}
}
function if_even($char) {
if(ord($char) % 2 == 0) {
return 'text-decoration:line-through;';
}
}
function if_letter($char) {
if(ctype_alpha($char)) {
return true;
} else {
return false;
}
}
?>