There are multiple ways to do this I'm sure. I have an array that looks like this:
$map=array(
'ABC'=>'first_three',
'DEF'=>'second_three',
'GHI'=>'third_three'
)
$info=array(
array('x','XXABCXXXX','x','x','x'),
array('x','XXXDEFXXXX','x','x','x'),
array('x','XXXXXXXXXX','x','x','x'),
array('x','XXXXXXXABC','x','x','x'),
array('x','XXXXXXXXXX','x','x','x')
)
I want to do a find/replace so that the 2nd string in the array will be compared to the keys in $map and if any are found, they'll replace the key with whatever was in the $map.
array('x','XXfirst_threeXXXX','x','x','x')
I want to loop through $info so:
foreach ($info as $i){
[something with $i[1] and $map]
}
What's the most efficient way to do this? Does it use "in_array"?
str_replace()inside the foreach