欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

字母順序顛倒而單詞順序不變的php代碼

 更新時間:2010年08月08日 16:38:57   作者:  
一個英文語句怎樣把它的每個單詞的字母順序顛倒而單詞順序不變?
php面試題說明 :

例如:my name is fanglor =》 ym eman si orlgnaf

php面試題的答案:
復制代碼 代碼如下:

function restr ($str)
{
$str1 = explode (' ',$str);
$str2 = '';
$temp = '';
for ($i=0;$i<count ($str1);$i++)
{
$str2 .= $temp.strrev ($str1[$i]);
$temp = ' ';
}
return $str2;

}

測試代碼:
復制代碼 代碼如下:

$str = "my name is fanglor ";
echo restr ($str);

打印結(jié)果:
ym eman si rolgnaf

相關文章

最新評論