something like array_walk?
| From: | A. J. McLean | Date: | Fri, 15 Nov 2002 10:16:41 +0000 |
| Subject: | something like array_walk? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-124574@lists.php.net to get a copy of this message | ||
I want to take an array and get the soundex() for each element in that array
and return the results into another array. Is there an clean way to do
this?
$color = array("blue", "green", "orange", "purple",
"red", "yellow");
function sound(&$word){
$word = soundex($word);
}
array_walk($color, 'sound');
print join(" ", $color);
This will print out the array $color, which is now changed to soundex, i.e.
the original array (up top) has changed--which I don't want. How can I
generate a separate array $colorsoundex?
Thank you.