$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
您可能感兴趣的文章: