note 23548 added to function.addslashes

From: Date: Mon, 22 Jul 2002 01:19:35 +0000
Subject: note 23548 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-33373@lists.php.net to get a copy of this message
I always had the problem of never knowing when slashes had already been added. I only needed them to be added once, and did not want to add them a second time. Here's a little function that will make sure your string will only be escaped once: function formatSlashes($string){ while(strstr($string,"\\")){ $string=stripslashes($string); } return addslashes($string); } -- http://www.php.net/manual/en/function.addslashes.php http://master.php.net/manage/user-notes.php?action=edit+23548 http://master.php.net/manage/user-notes.php?action=delete+23548 http://master.php.net/manage/user-notes.php?action=reject+23548

« previous php.notes (#33373) next »