How to print string in reverse order without using strrev() function:
<?php
$str_name = 'siva';
$len = strlen($str_name);
for($i=($len-1); $i>=0;$i--)
{
echo $str_name[$i];
}
?>
Another one
<?php
$str = 'siva';
$strrvse = implode(array_reverse(str_split($str)));
echo $strrvse;
?>
No comments:
Post a Comment