str_replace and associative arrays
| From: | Michael Crowl | Date: | Mon, 25 Feb 2002 22:00:47 +0000 |
| Subject: | str_replace and associative arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86164@lists.php.net to get a copy of this message | ||
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);