Here is my working code:
<!DOCTYPE HTML> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/> </head> <body> <?php $arabic = "ุตุญููุฉ ุงุณุจูุนูุฉ ู
ุณุชููุฉ ุดุงู
ูุฉ ุชุชุงุจุน ุงูุงุฎุจุงุฑ ูู ุงูู
ูุทูุฉ ุงูุนุฑุจูุฉ"; $french = "que voulez vous dire?"; if (isset($_POST['search'])) { $search = $_POST['search']; $key = $_POST['key']; $td = substr_count($arabic, $key); echo $td; } echo "<br />" . $arabic; function count_occurences($char_string, $haystack, $case_sensitive = true) { if ($case_sensitive === false) { $char_string = strtolower($char_string); $haystack = strtolower($haystack); } $characters = preg_split('//u', $char_string, -1, PREG_SPLIT_NO_EMPTY);
For $french it works well, but with $arabic it is not. Of course, there is no mistake, but if I enter, for example, ุญ to search for this letter, it always shows 0 for each letter that I entered.
Are there any errors? Or am I missing something with Arabic? I donโt know why in $french works well, if I enter v , it shows the result 2 .
echo_Me
source share