$str = "BJHXCC.COM";
function way1($str){
$result=strrev($str);
return $result;
}
function way2($str){
$len = strlen($str);
$new_str = '';
while( $len ){
$new_str .= $str[$len-1];
$len --;
}
return $new_str;
}
function way3($str, $encoding = 'utf-8'){
$len = mb_strlen($str);
$result = '';
for ($i = $len-1; $i>=0; $i--){
$result.= mb_substr($str,$i,1,$encoding);
}
return $result;
}
function way4($str){
$len = strlen($str);
$times = $len/2;
for($i = 0;$i <= $times; $i++ ){
$tmp = $str[$i];
$str[$i] = $str[$len-$i-1];
$str[$len-$i-1] = $tmp;
}
return $str;
}
function way5($str){
if(strlen($str)>0){
way5(substr($str,1));
}
echo substr($str,0,1);
return;
}
function way6($str){
$o = '';
$i = 0;
while(isset($str[$i]) && $str[$i] != null) {
$o = $str[$i++].$o;
echo $o;
echo "<br />";
}
}