Re: str_replace
| From: | John Gray | Date: | Sat, 15 Mar 2003 05:31:03 +0000 |
| Subject: | Re: str_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139779@lists.php.net to get a copy of this message | ||
$footer = str_replace('include("$header");', '', $footer);
The way you have it now, you're telling PHP to first include the file named by the variable $header, then do an str_replace on the result; but the parser is going to fail on that first semi-colon, and that's not what you want to do anyway (as I understand it). Put the line you want to replace inside single quotes (as above) and PHP won't attempt to parse it, it'll just treat it as a string literal. Hope this helps, hope it makes sense.
- john
Sebastian wrote:
This may seem weird: How do I str_replace an include function? I want to replace this line: include("$header"); with nothing .. something like this: $footer = str_replace(" '. include("$header"); .' ", "", $footer); I get errors, any ideas? cheers, - Sebastian