时间:2021-07-01 10:21:17 帮助过:18人阅读
下面的代码通过array_shift()函数加while循环不断移除数组的第一个元素,直到数组为空
<?php
$alpha = array("a", "b", "c");
while ( count( $alpha ) ) {
$val = array_shift( $alpha);
print "$val
";
print "there are ".count( $alpha )." elements in \$alpha
";
}
?>
希望本文所述对大家的php程序设计有所帮助。