【发布时间】:2013-09-27 10:12:33
【问题描述】:
我是 PHP 中这个关联数组概念的新手。现在我有一个名为 $sample 的数组,如下所示:
Array
(
[name] => definitions
[text] =>
[attributes] => Array
(
[name] => Mediation_Soap_Server_Reporting
[targetnamespace] => https://mediation.moceanmobile.net/soap/reporting
)
[children] => Array
(
[types] => Array
(
[0] => Array
(
[name] => types
[text] =>
[attributes] => Array
(
)
[children] => Array
(
[xsd:schema] => Array
(
[0] => Array
(
[name] => schema
[text] =>
[attributes] => Array
(
[targetnamespace] => https://mediation.moceanmobile.net/soap/reporting
)
[children] => Array
(
[xsd:complextype] => Array
(
[0] => Array
(
[name] => complextype
[text] =>
[attributes] => Array
(
[name] => Mediation_Soap_FaultMessage
)
[children] => Array
(
[xsd:sequence] => Array
(
[0] => Array
(
[name] => sequence
[text] =>
[attributes] => Array
(
)
)
)
)
)
)
)
)
)
)
)
)
)
)
我想从上面的数组中引用(或访问)键 xsd:schema。但我做不到。你能告诉我应该如何从关联数组名称$sample 中访问或引用这个键吗?提前致谢。
【问题讨论】:
-
我想你想要:
$sample['children']['types'][0]['children']['xsd:schema']?
标签: php arrays multidimensional-array associative-array