note 50688 deleted from function.str-replace by bjori

From: Date: Sun, 26 Mar 2006 22:25:39 +0000
Subject: note 50688 deleted from function.str-replace by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106675@lists.php.net to get a copy of this message
Note Submitter: somewhereinspace at deepspace dot com ---- This is an reply to Adam F-K's alphanumeric check: I guess my function does the same, but a bit quicker <?php // Checks, if the String contains only allowed Chars // edit the RegEx if you need other chars as well // for example: [^A-Za-zóòöôúùüûéèêáàäâÓÒÖÔÜÚÙÛÁÀÂÄ .-] // return true or false function isAlphaNumeric( $str ) { $len_org = strlen( $str ); $len_chk = strlen( ereg_replace( "[^A-Za-z0-9]", "", $str ) ); return $len_org == $len_chk; } ?> Ronald L.

« previous php.notes (#106675) next »