- PHP code
<?php$city=array('li','yang','wang');array_pad($city,5,'xie');foreach($city as $value){ print $value;}?>
为什么输出结果是“liyangwang”
不应该是”liyangwangxiexie“吗
------解决方案--------------------
$city = array_pad($city,5,'xie');
<?php$city=array('li','yang','wang');array_pad($city,5,'xie');foreach($city as $value){ print $value;}?>