There are many task that you can face when some one specify your some conditions like we are going to show you that reverse the string in php without using any type of function, means totally on core logic. Same type of work i’m going to show you today.
We are going to reverse a string without using any type of function with the help of some loops and conditions.
<form method="post"> <input type="text" name="txt" /><br /> <input type="submit" name="sbt" /> </form> <?php if (isset($_POST['sbt'])) { $text = $_POST['txt']; $p = 0; while( isset($text[$p]) ){ $p++; } $i = $p; while ($i){ $i--; echo $text[$i]; } } ?>
Just copy and paste the above code and give it any text in the textbox it will show you the reserve of that string.