Hello there,
I am trying to use substr_count() to count the number of Hebrew characters
in a string,
I tried substr_count($test, /[à-ú]/), but it returns 0 as if it can't
match the regex I have inserted there, I hoped it will work the same as
preg_match() that works great (preg_match(/[à-ú]/,
?
function count_hebrew($string)
{
$i=0;
while(preg_match(/[à-ú]/,$string))
{
$string=preg_replace(/[à-ú]/,,$string,1);
$i++;
}
return $i;
}
$hebrew_characters=??? àhhjúkkk;
$number_of_hebrew_characters=count_hebrew($hebrew_characters);
echo $number_of_hebrew_characters;
?
Op zondag 17
2 matches
Mail list logo