-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackwards.php
More file actions
39 lines (35 loc) · 1.06 KB
/
backwards.php
File metadata and controls
39 lines (35 loc) · 1.06 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Backwards</title>
</head>
<body>
<form action="backwards.php" method="POST">
a <input type="number" id="a" name="a" min="1" max="10"
step="0.02" value="3">
b <input type="number" id="b" name="b" min="1" max="10"
step="0.02" value="3">
<input type="submit" value="post" name="button">
</form>
<form action="str.php" method="GET">
<input type="text" name="tekst" size="30" placeholder="Your text to write backwars">
<input type="submit" name="button">
</form>
</body>
</html>
<?php
function backward($text) {
$wynik="";
for($i= strlen($text)-1; $i>=0; $i--)
$final.=$text[$i];
return $final;
}
if(isset($_GET["text"])and !empty($_GET["text"]))
{
$text=$_GET["text"];
echo backward($text);
}else{
echo "FAILED";
}
?>