Possible Duplicate:
Detect language from string in PHP
How do I change the class of a textarea based on the language it contains (arabic, spanish, etc)?
Possible Duplicate:
Detect language from string in PHP
How do I change the class of a textarea based on the language it contains (arabic, spanish, etc)?
Your orignial question mentions arabic.
If by detecting language you mean arabic vs. english characters, then you can use this:
preg_match('/[\x{0600}-\x{06FF}]/ui', $string)
Considering your input is in UTF-8 encoding, the character range for arabic is U+0600 to U+06FF, for some other language it's another set of characters, etc.