note 27825 added to function.strcspn

From: Date: Thu, 19 Dec 2002 22:42:15 +0000
Subject: note 27825 added to function.strcspn
Groups: php.notes 
Request: Send a blank email to php-notes+get-41139@lists.php.net to get a copy of this message
When you need something like... check a sting, comapre whit an another string, and if the sting's character is not on the another sting's character, then... anything. Then you should use this function: function strchk ($in,$eng){ $i=0; $fail=0; while ($i<strlen($in)) { $temp=""; $f=0; $ok=0; $temp=substr($in,$i,1); while ($f<strlen($eng)) { $temp2=""; $temp2=substr($eng,$f,1); if ($temp2==$temp){$ok=1;} $f++; } $i++; $f=0; if ($ok==0){$fail=1;break;} } return $fail; } --------------------------------- Usage: int value strchk(string to check, possible characters string); When all of the string's characters are can be find in the "possible characters sting", you will recive a 0. When not, you recive 1. by NetAnakroas -- http://www.php.net/manual/en/function.strcspn.php http://master.php.net/manage/user-notes.php?action=edit+27825 http://master.php.net/manage/user-notes.php?action=delete+27825 http://master.php.net/manage/user-notes.php?action=reject+27825

« previous php.notes (#41139) next »