-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.php
More file actions
35 lines (32 loc) · 804 Bytes
/
string.php
File metadata and controls
35 lines (32 loc) · 804 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
28
29
30
31
32
33
34
35
<!--
// Authors: Akash Chouhan
// Version 1.0
// Open-Source Code
-->
<?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.txt" download="assignmentbyakash">Download code</a>