php通过array_push()函数添加多个变量到数组末尾,array_push函数接受任意数量的变量添加。
<?php $alpha = array("a", "b", "c"); $final = array_push($alpha, "d","e"); print "There are $total elements in \$alpha<p>"; foreach ( $alpha as $val ) { print "$val<br/>"; } print "</p>"; ?>
经过上面的代码后,$final数组结果是: a,b,c,d,e ,array_push()函数返回最终数组的元素个数