1.list函数
list()可以将索引数组转为变量\不支持关联数组
$seo = ['我爱你';'PHP'];
list($a,$b) = $seo;
echo $a,$b;
结果为:
我爱你PHP
2.each函数
$people = array("Bill", "Steve", "Mark", "David");
print_r (each($people));
结果为:
Array
(
[1] => Bill
[value] => Bill
[0] => 0
[key] => 0
)
3.通过循环输出整个数组
$seo = ['我爱你','PHP'];
while (list($key,$val) = each($seo)) {
echo "$key => $val<br>";
结果为:
0 => 我爱你
1 => PHP
网友评论