php中文字符串翻转

<?php
header("Content-Type:text/html; charset=utf-8");
$str = "忙不";
$n = mb_strlen("$str",'utf-8');
$wStr = "";
for($i=$n;$i>=0;$i--)
{
  $wStr.= mb_substr($str,$i,1,'UTF-8');
}
echo $wStr;

你可能感兴趣的:(html,字符串,中文,str,休闲)