note 82092 added to function.stripslashes

From: Date: Thu, 27 Mar 2008 11:35:33 +0000
Subject: note 82092 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-137628@lists.php.net to get a copy of this message
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 ---- Server IP: 83.137.20.135 Probable Submitter: 84.53.67.94 ---- Manual Page -- http://www.php.net/manual/en/function.stripslashes.php Edit -- https://master.php.net/note/edit/82092 Del: integrated -- https://master.php.net/note/delete/82092/integrated Del: useless -- https://master.php.net/note/delete/82092/useless Del: bad code -- https://master.php.net/note/delete/82092/bad+code Del: spam -- https://master.php.net/note/delete/82092/spam Del: non-english -- https://master.php.net/note/delete/82092/non-english Del: in docs -- https://master.php.net/note/delete/82092/in+docs Del: other reasons-- https://master.php.net/note/delete/82092 Reject -- https://master.php.net/note/reject/82092 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137628) next »