note 108777 added to function.str-replace

From: Date: Thu, 24 May 2012 01:02:23 +0000
Subject: note 108777 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-188184@lists.php.net to get a copy of this message
I noticed that if you use mysql_real_escape_string() before performing str_replace, it won't work. This may be dependent on the string being replaced. Specifically, the following, won't work: $formattedPost = mysql_real_escape_string($formattedPost); $formattedPost = str_replace("\r\n", "<br>", $comment); Do this instead: $formattedPost = str_replace("\r\n", "<br>", $comment); $formattedPost = mysql_real_escape_string($formattedPost); ---- Server IP: 69.147.83.197 Probable Submitter: 50.132.28.184 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/108777 Del: integrated -- https://master.php.net/note/delete/108777/integrated Del: useless -- https://master.php.net/note/delete/108777/useless Del: bad code -- https://master.php.net/note/delete/108777/bad+code Del: spam -- https://master.php.net/note/delete/108777/spam Del: non-english -- https://master.php.net/note/delete/108777/non-english Del: in docs -- https://master.php.net/note/delete/108777/in+docs Del: other reasons-- https://master.php.net/note/delete/108777 Reject -- https://master.php.net/note/reject/108777 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188184) next »