1
I Iが一定の基準に基づいて特定の値を検索できるようにする、次の多次元配列: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: サブアレイ "テキスト"、与えられた検索: "1.00" を抽出しなければならないの次に
- type_of_work = "オプション1"
- 期間= "within_24_hours"
- の値
例2: 与えられ、サブアレイ "非テキストを" 検索:
- type_of_work = "オプション3"
- の時間枠= "within_24_hours"
- そして、 "50.00" の値私はこれを実現するにはどうすればよい
を抽出すべきか?
ハ!本当にありがとう!私はそれが働いた:) – Johny