I have this array with city codes:
$aryCityCodes = array ("LND", "NY");
And this other array with user data:
$ary = array (
array("John", "LND","London"),
array("Mary", "NY","New York"),
array("Larry", "AMS","Amsterdam")
);
I need to end up with an array like $ary but if the city code in $ary is contained in $aryCityCodes the name of the city in $ary has to be followed by "prime city"
So far, this is what I've done:
if($aryCityCodes)
{
if (count($ary) > 0)
{
foreach($ary as $item)
{
$bAux= false;
foreach ($item as $key => $value)
{
foreach ($aryCityCodes as $aCityCode)
{
if ($aCityCode == $value)
{
$bAux = true;
}
if($bAux)
{
$value = $value.' prime city';
}
}
}
}
}
}
But this does not work, it does not change the name of the city
What am I doing wrong?
Thanks!
as &$itemand as&$value