<?php
function rev($str){
$len = strlen($str);
for($i=$len;$i>=0;$i--){
$newstr.=$str{$i};
}
return $newstr;
}
$str = "abcde";
$new = rev($str);
echo '<pre/>';
print_r($new);
转载于:https://blog.51cto.com/1294872/1622945
<?php
function rev($str){
$len = strlen($str);
for($i=$len;$i>=0;$i--){
$newstr.=$str{$i};
}
return $newstr;
}
$str = "abcde";
$new = rev($str);
echo '<pre/>';
print_r($new);
转载于:https://blog.51cto.com/1294872/1622945