-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.txt
More file actions
53 lines (27 loc) · 783 Bytes
/
string.txt
File metadata and controls
53 lines (27 loc) · 783 Bytes
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
<?php
if(isset($_POST['submit']))
{
$text=$_POST['string'];
$split=$_POST['n'];
$sizestring=strlen($text);
if($sizestring<$split)
{
echo "String size should be greater than split size";
}
else
{
echo "<strong>input is:</strong>".$text;
$rev=strrev($text);
$newstring=implode(" ", str_split($rev, $split));
$finalstring=strrev($newstring);
echo "<br><strong>output is:</strong>".$finalstring;
}
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
enter string<br><input type="text" name="string"/><br>
enter value to split<br>
<input type="number" name="n"/><br>
<input type="submit" name="submit">
</form>
<a href="string.php" download="assignmentbyakash">Download code</a>