note 57106 added to function.str-replace
| From: | (mavis) | Date: | Fri, 23 Sep 2005 21:23:30 +0000 |
| Subject: | note 57106 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95671@lists.php.net to get a copy of this message | ||
please note
in the last post by dsi,
for escaping text to be XHTML compliant,
this would be better served by the functions:
htmlentities()
htmlspecialchars()
no?
in the previous post by dominicshaw,
escaping text for insertion in to a database, use
addslashes()
addcslashes()
(or see the PEAR::DB solution)
no?
aeron's text-to-image replacement (may '04)
might be better served by preg_replace():
$s = preg_replace('/([0-9])/','<img
src="\1.gif"></img>'); // not tested
t at seebach dot dk (oct '03) needle-highlighting will
break when invalid characters (special regex characters)
are present in the search string.
for this we need a preg_escape() function.
please see preg_match() for that.
and no, i don't have anything better to do.
-code till dawn,
mark meves
my email is my first name dot my last name
at gmail dot com. and yes, i write regexs for fun.
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57106
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57106&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57106&report=yes
Search -- http://master.php.net/manage/user-notes.php