note 86090 modified in function.str-ireplace by danbrown
| From: | danbrown@php.net | Date: | Thu, 02 Oct 2008 17:55:46 +0000 |
| Subject: | note 86090 modified in function.str-ireplace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-144992@lists.php.net to get a copy of this message | ||
Example for str_ireplace(). It will print "RePlaCeMe" in red color, but after this, it
would be written in lower case because of the string $search.
<?php
$search = 'replaceme';
$replace = '<font color="#FF0000">'.$search.'</font>';
$text = 'Please RePlaCeMe, OK?';
echo str_ireplace($search, $replace, $text);
?>
Example for ext_str_ireplace(). It will print "RePlaCeMe" in red color, and will not
change the capitalization:
<?php
$search = 'replaceme';
$replace = '<font color="#FF0000">$1</font>';
$text = 'Please RePlaCeMe, OK?';
echo ext_str_ireplace($search, $replace, $text);
?>
--was--
Sorry, I made a misstake at the code example below.
Example for str_ireplace(). It will print "RePlaCeMe" in red color, but after this, it
would be written in lower case because of the string $search.
<?php
$search = 'replaceme';
$replace = '<font color="#FF0000">'.$search.'</font>';
$text = 'Please RePlaCeMe, OK?';
echo str_ireplace($search, $replace, $text);
?>
Example for ext_str_ireplace(). It will print "RePlaCeMe" in red color, and will not
change the capitalization:
<?php
$search = 'replaceme';
$replace = '<font color="#FF0000">$1</font>';
$text = 'Please RePlaCeMe, OK?';
echo ext_str_ireplace($search, $replace, $text);
?>
http://php.net/manual/en/function.str-ireplace.php