note 50454 added to function.ord

From: Date: Tue, 01 Mar 2005 02:12:57 +0000
Subject: note 50454 added to function.ord
Groups: php.notes 
Request: Send a blank email to php-notes+get-85697@lists.php.net to get a copy of this message
Function using ord() to strip out garbage characters and punctuation from a string. This is handy when trying to be smart about what an input is "trying" to be.. <? function cleanstr($string){ $len = strlen($string); for($a=0; $a<$len; $a++){ $p = ord($string[$a]); # chr(32) is space, it is preserved.. (($p > 64 && $p < 123) || $p == 32) ? $ret .= $string[$a] : $ret .= ""; } return $ret; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.ord.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50454 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50454&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50454&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50454&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50454&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50454&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50454&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85697) next »