phpbar.de logo

Mailinglisten-Archive

[php] =?iso-8859-1?Q?Re:_=5Bphp=5D_ereg_replace_f=FCr_chat?=

[php] =?iso-8859-1?Q?Re:_=5Bphp=5D_ereg_replace_f=FCr_chat?=

Cyrill Schumacher webmasterbhs_(at)_bluewin.de
Sat, 11 Nov 2000 11:18:35 +0100


> $message = ereg_replace(":-)|:o)|:)","<img src=\"smiley.gif\">",$message);
> $message = ereg_replace(";-)|;o)|;)","<img
> src=\"zwinker.gif\">",$message);

umständlich:

$message =
preg_replace("/".preg_quote(":-)")."|".preg_quote(":o)")."|".preg_quote(":)"
)."/",
    "<img src=\"smiley.gif\">",$message);

$message =
preg_replace("/".preg_quote(";-)")."|".preg_quote(";o)")."|".preg_quote(";)"
)."/",
    "<img src=\"zwinker.gif\">",$message);

einfach:

$message = preg_replace("/:[-oO]?\)/",
    "<img src=\"smiley.gif\">",$message);

$message = preg_replace("/;[-oO]?\)/",
    "<img src=\"zwinker.gif\">",$message);

kiri




php::bar PHP Wiki   -   Listenarchive