I need to write a function which will return a boolean value depending on whether the character passed to it is English or not (a-zA-Z0-9).
Here is an example (note: the question marks are supposed to be Chinese characters) :
$str = "????????? (English words)"
for ($i=0; $i < strlen($str); $i++) {
if (isEnglish(substr($str, $i, 1))) {
do stuff here
}
}
The isEnglish function I have written so far is described above. The problem is that the Chinese characters are converted to ASCII and as thus, they appear like so: "¸f_µÃý·J¶°¦¨¹q¤lª© (English words)"
As you can see, the letters f,J, and q will return true when isEnglish is called.
So, does anyone know how I can avoid the Chinese characters and just find the true English characters in a string?
Thanks