Re: something like array_walk?
| From: | Marek Kilimajer | Date: | Fri, 15 Nov 2002 10:21:23 +0000 |
| Subject: | Re: something like array_walk? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124576@lists.php.net to get a copy of this message | ||
What about
foreach($color as $c) {
$color_soundex[]=soundex($c);
}
A. J. McLean wrote:
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.