Re: Getting all letters not in a string?
| From: | Richard Lynch | Date: | Sun, 30 Jun 2002 21:30:37 +0000 |
| Subject: | Re: Getting all letters not in a string? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-104775@lists.php.net to get a copy of this message | ||
>What is the easiest way to get an array of all letters not in a string? I.e.
>$array = notinstring("abc"); //returns array of:
>d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
>
>
I think this might do it:
$alphabet = 'abcdefghijklmnopqrstuvwxyz';
$abc = 'abc';
for ($i = 0; $i < strlen($abc); $i++){
$abcs[] = $abc[$i];
}
$notabc = preg_replace($abcs, '', $alphabet);
for ($i = 0; $i < strlen($notabc); $i++){
$notabcs[] = $notabc[$i];
}
--
Like Music? http://l-i-e.com/artists.htm