Re: str_replace on words with an array
| From: | Roman Neuhauser | Date: | Fri, 03 Nov 2006 16:53:46 +0000 |
| Subject: | Re: str_replace on words with an array | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-244150@lists.php.net to get a copy of this message | ||
# stuttle@gmail.com / 2006-10-30 21:18:33 +0000:
> Dotan Cohen wrote:
> > $searchQuery=str_replace( "^".$noiseArray."$", " ",
> > $searchQuery);
>
> Ok, this is what the compiler will see...
>
> $searchQuery=str_replace("^Array$", " ", $searchQuery);
>
> Yes, that's a literal Array in the string. You cannot, and you should
> remember this, you cannot concatenate strings and arrays. What would you
> expect it to do?
DTRT? This is what e. g. zsh does with the right configuration:
roman@dagan ~ 1108:0 > echo x-{aa,bb,cc}-y
x-aa-y x-bb-y x-cc-y
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991