note 19611 added to function.quotemeta

From: Date: Wed, 06 Mar 2002 00:51:21 +0000
Subject: note 19611 added to function.quotemeta
Groups: php.notes 
Request: Send a blank email to php-notes+get-27385@lists.php.net to get a copy of this message
function cleansql ($text) { $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); $count = count($chars); for ($c=0; $c<$count; $c++) { $letter=$chars[$c]; if (!preg_match("/[a-zA-Z0-9]/", $letter)) { $return .= "\\$letter"; } else { $return .= "$letter"; } } return $return; } # I use this so quote just about everything. # $blah='jason**$_'; # $newblah = cleansql($blah); # print "$newblah\n"; # returns: jason\*\*\$\_ -- http://www.php.net/manual/en/function.quotemeta.php http://master.php.net/manage/user-notes.php?action=edit+19611 http://master.php.net/manage/user-notes.php?action=delete+19611 http://master.php.net/manage/user-notes.php?action=reject+19611

« previous php.notes (#27385) next »