note 5880 deleted from function.ereg-replace by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:47:59 +0000 |
| Subject: | note 5880 deleted from function.ereg-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20184@lists.php.net to get a copy of this message | ||
Try using the PHP str_replace function. For instance, you can do
$text = str_replace("<%Name%>", $name, $text);
------------
I would to replace such Strings "<%String%>" from a HTML-template with the value of
$String. i.e. $Name = "Steve" "Hello <%Name%>..." should be replaced with
"Hello Steve". This don't works: $text = ereg_replace("<%([^*]*)%>",
"${'\\1'}", $text); Does anybody knows a code, that works?