Set string variable into reverse form using for loop and strlen() method.
Normally string functions gives us the facility to directly set string variable into reverse form but some times web developer needs to reverse string without using strrev() function in their programs in php coding page. So here is the complete step by step tutorial for Reverse string without strrev function in php using looping control.
How to Reverse string without strrev function in php using looping control.
Code for strrev_without.php file.
<?php //Declare string variable . $name = "Android-Examples.com"; //Get variable length . $name_length = strlen($name); for ($i=($name_length-1) ; $i >= 0 ; $i--) { //Printing reverse form. echo $name[$i]; } ?>
Screenshot: