note 57818 added to function.str-replace

From: Date: Sat, 15 Oct 2005 02:19:37 +0000
Subject: note 57818 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-97044@lists.php.net to get a copy of this message
There is problems trying to replace the < and > characters in an email address (copied from email header) so that it is displayed in HTML OK. Code: $formatted = str_replace("<", "&lt;", $myrow[desc]); $formatted = str_replace(">", "%gt;", $myrow[desc]); Input: <email@fred.com.au> produces corrupted output: <email@fred.com.au&gt which blocks out everything to the right of the <. I can't find how to quote < or get it to work so just trimmed out all the < and > by hand. ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57818 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57818&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57818&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97044) next »