Gary
asked on
Array str_replace
Does str_replace with an array only work on a row by row basis?
And when using it is there a way to say only if match the whole contents and not a partial match on the array element.
And when using it is there a way to say only if match the whole contents and not a partial match on the array element.
ASKER
It's thousands of rows in an array and each row has about 20 elements.
I'm thinking it might be easier to just load the file into a string and do a mass replace on everything I need replaceing and then parse it into an array.
I'm thinking it might be easier to just load the file into a string and do a mass replace on everything I need replaceing and then parse it into an array.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points, ~Ray
ASKER
I would choose the way that makes the most sense programaticallyDoing a mass replace (using the delimiter to identify the whole field) is a lot easier than trying to process on an element by element and row by row basis - just thinking about coding that made the mass replace the best route (which takes one line).
http://php.net/manual/en/function.str-replace.php
The simplest rules are all you get with str_replace() so if you want greater specificity your best choice is preg_replace()