<?php
//string_substr2.php
$str1 = "php free download";
?>
<html>
<title> string_substr2.php</title>
<body bgcolor="#E7F2F5" text="#000080">
<br/>
<table border="1"><tr><td>Original </td><td>Replaced</td></tr><tr><td
width="200">
<?php
for($i= strlen($str1); $i >0;$i--)
{
$ch =substr($str1, -($i));
echo "<br/>$ch   $i";
}
?>
</td><td width="200">
<?php
for($i= 0; $i <strlen($str1 );$i++)
{
$ch =substr($str1, -($i));
echo "<br/> $ch   $i ";
}
?></td></tr></table>
</body>
</html>