Re: str_replace
| From: | Philip Olson | Date: | Wed, 31 Jan 2001 16:49:55 +0000 |
| Subject: | Re: str_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37500@lists.php.net to get a copy of this message | ||
Because you must replace it after $total and $buffer are defined, not
before.
This works :
<?php
$total = 'foo';
$buffer = 'blah blah %99 blah blah';
$buffer = str_replace('%99', $total, $buffer);
print $buffer;
?>
This does not work :
<?php
$buffer = str_replace('%99', $total, $buffer);
$total = 'foo';
$buffer = 'blah blah %99 blah blah';
print $buffer;
?>
Regards,
Philip Olson
http://www.cornado.com/
On Wed, 31 Jan 2001, Augusto Cesar Castoldi wrote:
> In the begin of my site, I have the following code:
> <?
> $buffer = str_replace("%99", $total, $buffer);
> ?>
>
> And somewhere on <html> tag I write %99.
>
> I pretend to replace the %99 with $total. Why it doesn't work? When I
> publish my site appears the %99 on screen, and not the $total.
>
> thanks,
>
> Augusto Cesar Castoldi
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>