View Single Post
Old 10-12-2007, 08:51 AM   #14 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
Hey that's cool. I didn't know str_replace took arrays as arguments.

Quote:
Can this code be edited to achieve the end result without using arrays
To answer your question though, no. You would at least need to define 1 array which would be the number words keyed by the numbers. To do it that way though you would need to loop through your array to do an individual replacement for each number instead of all of them at once as your code does.

now if you were using only 1 array and replacing characters as you looped through your array, you could define another array or string which would be 'characters to search'. in each loop of the array, you would simply check if that current character existed in the 'characters to search' arrray or string and only do the replacement if it does.
__________________
Mike
sde is offline   Reply With Quote