note 108777 deleted from function.str-replace by mikemike

From: Date: Mon, 28 Apr 2014 15:28:52 +0000
Subject: note 108777 deleted from function.str-replace by mikemike
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199359@lists.php.net to get a copy of this message
Note Submitter: eggmatters at gmail dot com ---- 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: <?php $formattedPost = mysql_real_escape_string($formattedPost); $formattedPost = str_replace("\\r\\n", "<br>", $comment); ?> Do this instead: <?php $formattedPost = str_replace("\\r\\n", "<br>", $comment); $formattedPost = mysql_real_escape_string($formattedPost); ?>

« previous php.notes (#199359) next »