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.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to