>From the manual (http://www.php.net/manual/en/function.str-replace.php <http://www.php.net/manual/en/function.str-replace.php> ) "In PHP 4.0.5 and later, every parameter to str_replace() can be an array. "
I tried a test case (php 4.0.0) and found that if I passed an array in as the subject the search and replace was performed on the string "array". Tim Ward Internet chess www.chessish.com <http://www.chessish.com> ---------- From: Michael Crowl [SMTP:[EMAIL PROTECTED]] Sent: 25 February 2002 22:01 To: [EMAIL PROTECTED] Subject: str_replace and associative arrays I haven't been able to find any leads on this in the archives, nor in the documentation, so here goes. When feeding an associative array to str_replace as the subject, does it still return an associative array? My instance: extract(str_replace(",","",$result_row)); After pulling an associative array using mysql_fetch_array(), I can feed it to extract() by itself and it works as predicted and documented. However, if I do the above, where I want to make sure that the text fields (from the db) that I'm using have the commas stripped out of them, extract() chokes with a "Warning: Bad datatype for extract()". I'm sure there are no commas in the key names, so those shouldn't be altered. My only assumption is that str_replace returns array results without keys, even though it should take and return mixed subjects, correct? I may just be missing something obvious here, so have pity on a poor soul. You've all been there. (And one of the problems may be that I'm working off of PHP 4.0.3...) $leepless_in_seattle(me); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php