Re[2]: [PHP] str_replace to ignore commas

From: Date: Tue, 06 Jan 2004 16:15:12 +0000
Subject: Re[2]: [PHP] str_replace to ignore commas
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-173862@lists.php.net to get a copy of this message
Hello Vernon, Tuesday, January 6, 2004, 3:56:18 PM, you wrote: >> Nowhere in your replacement array do you check for, or remove, >> carriage returns. >> Add this \n to it: >> $replacement = array("\"", "\,", ".", "!", >> "?", "\n"); >> Your exploded array should now be correct. V> When I do this I get some really unexpected results. Almost everything comes V> up bold. Remove the back-slash before the comma in the replacement array, it doesn't work if you have it. Otherwise, it fulfills the criteria of removing the characters you requested from the string, therefore the error lies elsewhere either in the original data containing something that isn't being taken into consideration, or the high-lighting working on different rules. One possible issue is the fact that if you remove all comma's and carriage returns, the following: New York, was here will become exploded as: New Yorkwas here Perhaps you don't want to actually remove carriage returns at all, but rather substitute them with spaces - like I said though, it depends on your original data. -- Best regards, Richard mailto:rich@launchcode.co.uk

« previous php.general (#173862) next »