1
我下面,我希望能够基于特定标准来搜索一个特定的值多维数组:如何从php中的多维数组中获取值?
$pay_rate_lookup = array(
"text" => array(//rates for text files
"type_of_work" => array(
"option1" => array(
"timeFrame" => array(
"within_24_hours" => 1.00,
"within_1_2_days" => 2.00,
"within_3_5_days" => 3.00,
"within_1_2_weeks" => 4.00
)
),
"option2" => array(
"timeFrame" => array(
"within_24_hours" => 5.00,
"within_1_2_days" => 3.00,
"within_3_5_days" => 2.00,
"within_1_2_weeks" => 2.00
)
),
"option3" => array(
"timeFrame" => array(
"within_24_hours" => 5.00,
"within_1_2_days" => 5.00,
"within_3_5_days" => 4.00,
"within_1_2_weeks" => 2.00
)
),
"option4" => array(
"timeFrame" => array(
"within_24_hours" => 2.00,
"within_1_2_days" => 8.00,
"within_3_5_days" => 5.00,
"within_1_2_weeks" => 1.00
)
)
)
),
"non-text" => array(
"type_of_work" => array(
"option1" => array(
"timeFrame" => array(
"within_24_hours" => 10.00,
"within_1_2_days" => 20.00,
"within_3_5_days" => 30.00,
"within_1_2_weeks" => 40.00
)
),
"option2" => array(
"timeFrame" => array(
"within_24_hours" => 50.00,
"within_1_2_days" => 30.00,
"within_3_5_days" => 20.00,
"within_1_2_weeks" => 20.00
)
),
"option3" => array(
"timeFrame" => array(
"within_24_hours" => 50.00,
"within_1_2_days" => 50.00,
"within_3_5_days" => 40.00,
"within_1_2_weeks" => 20.00
)
),
"option4" => array(
"timeFrame" => array(
"within_24_hours" => 20.00,
"within_1_2_days" => 80.00,
"within_3_5_days" => 50.00,
"within_1_2_weeks" => 10.00
)
)
)
)
);
我想要做的是检索基础上给出的type_of_work和时间表的标准数值用户。
例1: 查询的子阵列 “文本”,给出:
- type_of_work = “选项1”
- TIMEFRAME = “within_24_hours”
- 接着的 “1.00” 应该提取 值
示例2: 搜索子阵列“非文本”,给出:
- type_of_work = “2选项”
- 时间表= “within_24_hours”
- 随后的 “50.00” 值应提取
我怎样才能做到这一点?
哈!谢谢一堆!我得到它的工作:) – Johny