Re: Exact string replacement...
| From: | Brian Clark | Date: | Sat, 09 Feb 2002 07:40:07 +0000 |
| Subject: | Re: Exact string replacement... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84087@lists.php.net to get a copy of this message | ||
* Desikan (desikb4u@fastmail.fm) [Feb 09. 2002 02:17]:
> Hi there,
Hi,
> Please help me out in the following...
> <?php
> $is='is';
> echo eregi_replace(" ".$is." "," ","This is a test string
> which contains
> is in dismissal");
> ?>
> Actually I want to replace "is" alone from the string and not all the
> words that contains is...
str_replace() would be easier:
<?php
$string = ' foo ';
print str_replace($string,' nude ','This is a foo bar.');
?>
--
Headers set. CCs on list replies -> bit bucket.
Brian Clark | Unable to leap tall buildings in a single bound.
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8