// You can call the function as you like
if (!function_exists('mb_str_word_count'))
{
function mb_str_word_count($string, $format = 0, $charlist = '[]') {
mb_internal_encoding( 'UTF-8');
mb_regex_encoding( 'UTF-8');
$words = mb_split('[^\x{0600}-\x{06FF}]', $string);
switch ($format) {
case 0:
return count($words);
break;
case 1:
case 2:
return $words;
break;
default:
return $words;
break;
}
};
}
echo mb_str_word_count("القاهرة هى عاصمة مصر وباریس هى عاصمة فرنسا") . PHP_EOL
Save PL/pgSQL output from PostgreSQL to a CSV file
mb ,count ,str ,word ,function ,words ,str word ,word count ,words break ,mb str ,utf 8 ,return words break
درباره این سایت