[PHP] Detecting language
Hi I have an application that works with two languages. I'm trying to write a function that will tell me if a string contains only English or also chars from the other language. It's enough that there is one char of a different language to make the function return a true value. I guess I'm not inventing the wheel here... Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting language
On Monday, April 15, 2002, at 02:43 PM, Boaz Yahav wrote: I have an application that works with two languages. I'm trying to write a function that will tell me if a string contains only English or also chars from the other language. It's enough that there is one char of a different language to make the function return a true value. I guess I'm not inventing the wheel here... I would create an array of characters according to your definition of English characters, and then check to see if any of those characters are in the string. But since the trend appears to be in moving toward Unicode, the official distinction of an English character vs any other language's character is becoming blurry -- at least in the field of information delivery. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Detecting language
In case anyone is interested Function IsHebrew($string) { If(ereg('[?-?]',$string,$regs)) { EchoHebrew; }Else{ EchoEnglish; } } Not everyone can see the [?-?]. In any case this can be good for any language berber -Original Message- From: Boaz Yahav Sent: Monday, April 15, 2002 8:44 PM To: PHP General (E-mail) Subject: [PHP] Detecting language Hi I have an application that works with two languages. I'm trying to write a function that will tell me if a string contains only English or also chars from the other language. It's enough that there is one char of a different language to make the function return a true value. I guess I'm not inventing the wheel here... Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php