Sorry can't deal with blogger any more.
New url is http://wwwebber.wordpress.com/
$before = array(
"White Plains" => "NY",
"New York City" => "NY",
"Philadelphia" =>"PA",
"Tampa" =>"FL",
"Miami" =>"FL"
);
$after = array('NY' => White Plains,New York City,
'PA' => Philadelphia,
'FL' => Tampa,Miami
)
Here's the function...enjoy
before = array( "White Plains" => "NY", "New York City" => "NY", "Philadelphia" =>"PA", "Tampa" =>"FL", "Miami" =>"FL" ); function createHashMap(&$mc){ $hashMap = array(); while ($name = current($mc)) { $key = key($mc); //echo "key: $key , current: ". $name . '
'; if(isset($name,$hashMap)){ $hashMap["'". $name ."'"] .= $key .',' ; } else{ $hashMap["'". $name ."'"] = "'". trim($key) ."'" ; } next($mc); } //print em out foreach($hashMap as $key => $value) echo $key . ' => ' . $value . '
'; } createHashMap($before);