Hey All,
While there's no shortage of multidimensional array search posts/solutions in the many forums, I'm having difficulty applying/translating any of them into a solution for my particular problem. Here it is.
Please, I would like to script a "search" throught all 365 children of the following array for the name[#] of the child array where $city_name_string is "contained" within [child][2],
//for example, where
$city_name_string = 'New York';
//The desired result would be the return of
$msa_nick = $msa_stats[1][1];
//because the string 'New York' is contained within $msa_stats[1][2]
$msa_name = $msa_stats[1][2];
$msa_06pop = $msa_stats[1][5];
echo "Metro Nick Name: " . $msa_nick "<br />";
echo "Metropolitan Statistical Area: " . $msa_name"<br />";
echo "MSA 2006 Population: " . $msa_06pop"<br />";
//given the following array
$msa_stats= Array
(
[0] => Array
(
[0] => Rank
[1] => Metro Nickname
[2] => Metropolitan Statistical Area
[3] => State
[4] => 2006 Pop
[5] => 2000 Pop
[6] => Δ Pop
[7] => Combined Statistical Area
)
[1] => Array
(
[0] => 1
[1] => Greater New York
[2] => New York-Northern New Jersey-Long Island, NY-NJ-PA MSA
[3] => NY-NJ-PA
[4] => 18,818,536
[5] => 18,323,002
[6] => A597+2.70%
[7] => New York-Newark-Bridgeport, NY-NJ-CT-PA CSA
)
[2] => Array
(
[0] => 2
[1] => Greater Los Angeles/ Southland
[2] => Los Angeles-Long Beach-Santa Ana, CA MSA
[3] => CA
[4] => 12,950,129
[5] => 12,365,627
[6] => A415+4.73%
[7] => Los Angeles-Long Beach-Riverside, CA CSA
)
);