I have the array variable $geo_detail=Array ( [0] => nsu [1] => us east [2] => us west )
I want to replace nsu with NSU ,us east to US East and us west to US West
I have tried as
if (count($geo_detail))
{
foreach($geo_detail as $geos=>$key){
if (str_word_count($key) =='1')
$key= strtoupper($key);
elseif((str_word_count($key) =='2'))
$key= ucwords($key);
}
}
return $geo_detail;
but return Array ( [0] => nsu [1] => us east [2] => us west )
how to replace the array value