php 数组操作(增加,删除,查询,排序)等函数说(2)


$families = array
(
"Griffin"=>array
(
"Peter",
"Lois",
"Megan"
),
"Quagmire"=>array
(
"Glenn"
),
"Brown"=>array
(
"Cleveland",
"Loretta",
"Junior"
)
);


如果输出这个数组的话,应该类似这样:

复制代码 代码如下:


Array
(
[Griffin] => Array
(
[0] => Peter
[1] => Lois
[2] => Megan
)
[Quagmire] => Array
(
[0] => Glenn
)
[Brown] => Array
(
[0] => Cleveland
[1] => Loretta
[2] => Junior
)
)



例子 2
让我们试着显示上面的数组中的一个单一的值:

echo "Is " . $families['Griffin'][2] . " a part of the Griffin family?";
以上代码的输出:
Is Megan a part of the Griffin family?

1

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/dc80fede46589af49a3684056696386f.html