I'm trying to search for a value in a multi dimensional array (below is only a part of the big array) and get the key for that value but I can't manage it by myself. Here is what I have tried :
Array
(
[0] => Array
(
[0] => SMEG - 30
[1] => ALES
[2] => -
[3] => -
[4] => -
[5] => ALES
[6] => 44-
[7] => -
[8] => FR*S30*E36*1*1
[9] => FR*S30*E36*1*1
[10] => US*S30
[11] => Oui
[12] => 3376
[13] => Normale
[14] => -
)
[1] => Array // <-- wanted key
(
[0] => SMEG - 30
[1] => ALES
[2] => -
[3] => Chemin Des Sports
[4] => -
[5] => ALES
[6] => -
[7] => -
[8] => FR*S30*E37*2*1 // <-- wanted value
[9] => FR*S30*E37*2*1
[10] => FR*S30
[11] => Oui
[12] => 33762
[13] => Normale
[14] => -
)
[2] => Array
(
[0] => SMEG - 30
[1] => ALES
[2] => 0
[3] => Ecole Des Mines
[4] => -
[5] => ALES
[6] => 4-
[7] => -
[8] => FR*S30*E38*2*1
[9] => FR*S30*E38*2*1
[10] => FR*S30
[11] => Oui
[12] => 3376
[13] => Normale
[14] => -
)
)
$key = array_search("FR*S30*E37*2*1", array_column($data, '8'));
var_dump($data[$key]);
With this code I can't get the key of desired array. What am I doing wrong ?