|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to check if $string contains Hebrew characters?
Hi,
I have a $string and i want to know if it contains Hebrew characters in it, I wrote the following: function containHebrewChars ($string) { $chars = "אבגדהוזחטיכלמ*סעפצקרשת"; // ABC of hebrew chars (AlefBet) $chars = preg_replace("/([\xE0-\xFA])/e","chr(215).chr(ord(\${1})-80)",$chars); // convert it to UTF8 if (preg_match("/[".$chars."]/", $string)) return true; return false; } > I'm pretty sure there is a better way to do this (regex is overkill), any ideas? Regards, Nitsan |
![]() |
| Viewing: Web Development Archives > Mailing Lists > PHP > How to check if $string contains Hebrew characters? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|