11/2222222/33333/4444444
11/222/2222/33333/4444444
11/222/2222/33/333/4444444怎么得到4444444
因为前面的不是一定的。。我只想得到最后一条。。这样怎么搞。。
谢谢
11/222/2222/33333/4444444
11/222/2222/33/333/4444444怎么得到4444444
因为前面的不是一定的。。我只想得到最后一条。。这样怎么搞。。
谢谢
$a = array('11','222222','3333','44444');var_dump($a[count($a)-1]);
$str='11/222/2222/33/333/4444444 ';
$arr=explode('/',$str);
$i=count($arr)-1;
$tstr=$arr[$i];
echo $tstr;
你试试!
echo $one;//11
echo $two;//2222222
echo $three;//33333
echo $four;//444444
//1
$str = '11/222/2222/33333/4444444';
echo substr($str,strrpos($str,'/')+1)."<br/>";
//2
$n = strtok($str,'/');
while($n = strtok('/')){$x = $n;}
echo $x."<br/>";
//3
$arr = explode('/',$str);
echo $arr[count($arr)-1]."<br/>";