数组
(
[1] => Array
(
[A] => Rina
[B] => Reding
[C] => 9987536263
[D] => 47
[E] => NO
)
[2] => Array
(
[A] => Anna
[B] => Jones
[C] => 0243055454
[D] => 90
[E] => YES
)
[3] => Array
(
[A] => Mario
[B] => Arinken
[C] => 5654678679
[D] => 80
[E] => YES
)
)
当get是[C]时,如何使用GET函数在此Array输出中搜索? 结果应如下所示:您的结果:[D]考试通过:[E] 即GET 5654678679 和结果 是: 您的结果:80考试通过:是 示例http://goo.gl/rkJwfU 该数组使用“Excel to PHP array”
生成答案 0 :(得分:1)
认为您正在寻找array_search或in_array
之类的内容答案 1 :(得分:0)
$array=Array(
1 => Array
(
'A' => 'Rina',
'B' => 'Reding',
'C' => 9987536263,
'D' => 47,
'E' => 'NO'
),
2 => Array
(
'A' => 'Anna',
'B' => 'Jones',
'C' => '0243055454',
'D' => 90,
'E' => 'YES'
),
3 => Array
(
'A' => 'Mario',
'B' => 'Arinken',
'C' => '5654678679',
'D' => 80,
'E' => 'YES'
)
);
//$pc=$_GET["PERSONAL_CODE"];
$pc='5654678679';//Test Case
$C=array();
foreach($array as $k=>$v){
$C[$v['C']]=$k;
}
echo "Your result: ".$array[$C[$pc]]['D']." Exam passed:".$array[$C[$pc]]['E'];