Re: test for ascii or binary string

From: Date: Sat, 30 Nov 2002 04:40:34 +0000
Subject: Re: test for ascii or binary string
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-126514@lists.php.net to get a copy of this message
Doh, so simple. I guess the correct form of the question would be how do I determine if a string has just a-zA-Z0-9 in it plus punctuation... thanks, -js Paul Chvostek wrote: > On Fri, Nov 29, 2002 at 10:27:05PM -0600, Jonathan Sharp wrote: > >>Is there a way to determine if a string has ascii or binary data in it? > > > You could always see if it matches a regular expression that represents > the ascii range you're considering. I.e., ereg('[^a-zA-Z0-9]',$string) > will return true if non-alphanumerics are in the string. > > Remember that a string is just a string. Whether the data contained in > it is represented as ASCII or something else is completely a matter of > implementation. ALL 7-bit data can be represented as ASCII. All 8-bit > data can be represented as "IBM Extended ASCII" or whatever you want to > call it. But the string is just a string of bits. >

« previous php.general (#126514) next »