php 截取取最后一个字符【转】
方法一:
$str = " www.wdphp.com ";
$var = trim($str);
$len = strlen($var)-1;
echo $var[$len];
方法二:
$str = "www.wdphp.com";
echo substr($str, -1);
方法一:
$str = " www.wdphp.com ";
$var = trim($str);
$len = strlen($var)-1;
echo $var[$len];
方法二:
$str = "www.wdphp.com";
echo substr($str, -1);