PHP
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists PHP

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old June 25th, 2008, 10:51 AM
Nitsan Bin-Nun
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists PHP > How to check if $string contains Hebrew characters?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT