note 16051 added to function.str-replace
| From: | raspi at nic dot fi | Date: | Sun, 14 Oct 2001 23:13:20 +0000 |
| Subject: | note 16051 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18911@lists.php.net to get a copy of this message | ||
$data = ":) :(";
$a = array(
":)" => "smile",
":D" => "laugh",
":(" => "sad"
);
foreach ($a as $f => $t) {
$data = str_replace($f,$t,$data);
}
echo $data; // = "smile sad"
--
http://www.php.net/manual/en/function.str-replace.php
http://master.php.net/manage/user-notes.php?action=edit+16051
http://master.php.net/manage/user-notes.php?action=delete+16051
http://master.php.net/manage/user-notes.php?action=reject+16051