explode 用法之误

http://www.php.net/manual/zh/function.explode.php 参考php 手册里面

其中有对于 <?php
$str "";
$res explode(","$str);
print_r($res);
?>  这种情况进行解析 我以为返回应该是 array() (这是错误的)

实际答案: array(

              0=> ""

              );

 

解决方法为

<?php
$str "";
$res array_filter(explode(","$str));
print_r($res);
?>

Array
(
)

 

 

平时对手册看的不够仔细 没有耐心下来查看 切记 下次一定好好看看手册。 自以为(带有默认性质)是妄自认为,害人,编程要讲究证据, 讲究依据。。 不能自以为。。

posted on 2015-11-25 10:46  holy翟翟  阅读(109)  评论(0编辑  收藏  举报

导航