Online Snippets Library

Reverse string in php without built in functions

In Below example we will reverse string without built in functions.

Example

<?php
$string = "manish";
$length = strlen($string);
for ($i=($length-1) ; $i >= 0 ; $i--) 
{
  echo $string[$i];
}

?>

Out Put

Reverse string: hsinam