Hi
I'm looking to search an array for specific keywords, and then return the array key if there is a match.
My array is :
$c[0]="12345";
$c[1]="ABCD,A=0987654,1=\"555666777\",5=DEDEDE,3=\"28FFDE\"";
Which print_r shows as :
print_r($c)."<br>";
Array
(
[0] => 12345
[1] => ABCD,A=0987654,1="555666777",5=DEDEDE,3="28FFDE"
)
I'm then exploding $c[1] into a new array:
$l = explode(",",$c[1]);
Which print_r shows as:
print_r($l)."<br>";
Array
(
[0] => ABCD
[1] => A=0987654
[2] => 1="555666777"
[3] => 5=DEDEDE
[4] => 3="28FFDE"
)
What I would like to do is search $l for A= and return the key of 1, so I can the reference that key/value later.
A= won't always be at key entry 1, it would be anywhere..
Any ideas ?
I had thought I could use :
$key = array_search('A=', $l);
But that didn't seem to do anything when I echo'd $key;
Any ideas ? Thanks