How to reverse a string without using php function in php?

How to reverse a string without using function in php
<?php
error_reporting(NULL);
$string = 'This is a reversed string';
$len = 0;
do{
$len++;
}
//$len is the length of string

while($string[$len]!='');
for($i=$len-1;$i>=0;$i--){
echo $string[$i];
}
?>

gnirts desrever a si sihT

Comments