php通过array_unshift函数添加多个变量到数组前端,函数返回添加后的数组元素个数
<?php $alpha = array("a", "b", "c"); $final = array_unshift($alpha, "d","e"); print "There are $total elements in \$alpha<p>"; foreach ( $alpha as $val ) { print "$val<br/>"; } print "</p>"; ?>
-执行上面的代码后,$final数组为: d,e,a,b,c ,
array_unshift() 函数的返回值为最终数组的元素个数