note 82092 deleted from function.stripslashes by felipe

From: Date: Sat, 29 Mar 2008 15:54:20 +0000
Subject: note 82092 deleted from function.stripslashes by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137714@lists.php.net to get a copy of this message
Note Submitter: techdesk100 Reason: 1 ---- Function which checks if $input has correct slashes, otherwise adds slashes. public function addslashes_once($input){ //These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte). $pattern = array("\\'", "\\\"", "\\\\", "\\0"); $replace = array("", "", "", ""); if(preg_match("/[\\\\'\"\\0]/", str_replace($pattern, $replace, $input))){ return addslashes($input); } else{ return $input; } } If someone sees an error please comment

« previous php.notes (#137714) next »