Breaking News
Home / PHP / Reverse string without strrev function in php using looping control

Reverse string without strrev function in php using looping control

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:

 

About VikasKumar

This Website is Full Free Download Metas ...................

Check Also

Print Echo array values on screen using forEach loop in php

Display all array list elements one by one using ForEach loop control statement echo in …