Related Class Documentation
<?php
$text = <<< END
<p><b> Peace سلام
שלום Hasîtî
शान्ति Barış 和平 Мир
</b></p>
END;
require('I18N/Arabic.php');
$Ar = new I18N_Arabic('Identifier');
$pos = $Ar->identify($text);
$total = count($pos);
echo substr($text, 0, $pos[0]);
for($i=0; $i<$total; $i+=2){
echo '<font color="#FFFF00">';
echo substr($text, $pos[$i],
$pos[$i+1]-$pos[$i]);
echo '</font>';
echo substr($text, $pos[$i+1],
$pos[$i+2]-$pos[$i+1]);
}
$word = 'Khaled';
echo "<br /><br />($word) is Arabic? ";
var_dump($Ar->isArabic($word));
$word = 'خالد';
echo "<br /><br />($word) is Arabic? ";
var_dump($Ar->isArabic($word));
?>
|
(Khaled) is Arabic? string(0) ""
(خالد) is Arabic? string(1) "1"
|
|