【发布时间】:2020-01-25 02:32:02
【问题描述】:
我有一个大型多维数组,其中多次出现#options 索引。以下是单个数组示例:
FORM => Array
(
[#attached] => Array
(
[library] => quiz/quiz-form-styling
)
[text_0] => Array
(
[#type] => markup
[#markup] =>
Wherelese did Walter White work besides being a teacher?
)
[radio_1] => Array
(
[#type] => radios
[#options] => Array
(
[0] => An elder Care home
[1] => [A car wash]
[2] => A beauty saloon
[3] => For Skylers old boss
)
[#correct] => testing_correct_for radio
)
[text_2] => Array
(
[#type] => markup
[#markup] =>
)
)
在上面的例子中,#options 的父数组是radio_1。但情况并非总是如此,因为数组是动态生成的。无法提前知道父索引是什么,但总有一个 #options 索引。
我想弄清楚的是如何在所有出现的 #options 中查找和检索数据。我该怎么做?
【问题讨论】: