note 27825 deleted from function.strcspn by aidan
| From: | aidan@php.net | Date: | Fri, 27 Aug 2004 09:23:13 +0000 |
| Subject: | note 27825 deleted from function.strcspn by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75408@lists.php.net to get a copy of this message | ||
Note Submitter: netanakroas at freemail dot hu
----
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