Example Code:
<?php
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Soundex');
$Clinton = array('كلينتون', 'كلينتن', 'كلينطون', 'كلنتن', 'كلنتون', 'كلاينتون');
echo <<<END
<table border="0" cellpadding="5" cellspacing="2" align="center">
<tr>
<td colspan="3">Listed below are 6 different spelling for the name
<i><a href="http://en.wikipedia.org/wiki/Bill_Clinton" target=_blank>Clinton</a></i>
found in collection of news articles in addition to original English spelling.</td>
</tr>
<tr>
<td bgcolor=#000000 width=33%><b><font color=#ffffff>Function</font></b></td>
<td bgcolor=#000000 width=33%><b><font color=#ffffff>Input</font></b></td>
<td bgcolor=#000000 width=33%><b><font color=#ffffff>Output</font></b></td>
</tr>
END;
echo '<tr>
<td bgcolor=#f5f5f5>PHP soundex function</td>
<td bgcolor=#f5f5f5>Clinton</td>
<td bgcolor=#f5f5f5>' . soundex('Clinton') . '</td>
</tr>';
foreach ($Clinton as $name) {
echo '<tr>
<td bgcolor=#f5f5f5>ArSoundex Method</td>
<td bgcolor=#f5f5f5>' . $name . '</td>
<td bgcolor=#f5f5f5>' . $Arabic->soundex($name) . '</td>
</tr>';
}
echo '<tr>
<td bgcolor=#f5f5c5>ArSoundex Method</td>
<td bgcolor=#f5f5c5>كلينزمان</td>
<td bgcolor=#f5f5c5>' . $Arabic->soundex('كلينزمان') . '</td>
</tr>';
echo <<<END
<tr>
<td colspan=3> </td>
</tr>
<tr>
<td colspan=3>Listed below are 6 different spelling for the name
<i><a href="http://en.wikipedia.org/wiki/Milosevic" target=_blank>Milosevic</a></i>
found in collection of news articles in addition to original English spelling.</td>
</tr>
<tr>
<td bgcolor=#000000><b><font color=#ffffff>Function</font></b></td>
<td bgcolor=#000000><b><font color=#ffffff>Input</font></b></td>
<td bgcolor=#000000><b><font color=#ffffff>Output</font></b></td>
</tr>
<tr>
END;
$Milosevic = array('ميلوسيفيتش', 'ميلوسفيتش', 'ميلوزفيتش', 'ميلوزيفيتش', 'ميلسيفيتش', 'ميلوسيفتش');
echo '<tr>
<td bgcolor=#f5f5f5>PHP soundex function</td>
<td bgcolor=#f5f5f5>Milosevic</td>
<td bgcolor=#f5f5f5>' . soundex('Milosevic') . '</td>
</tr>';
foreach ($Milosevic as $name) {
echo '<tr>
<td bgcolor=#f5f5f5>ArSoundex Method</td>
<td bgcolor=#f5f5f5>' . $name . '</td>
<td bgcolor=#f5f5f5>' . $Arabic->soundex($name) . '</td>
</tr>';
}
echo '<tr>
<td bgcolor=#f5f5c5>ArSoundex Method</td>
<td bgcolor=#f5f5c5>ميلينيوم</td>
<td bgcolor=#f5f5c5>' . $Arabic->soundex('ميلينيوم') . '</td>
</tr></table>';
Total execution time is 0.0019509792327881 seconds
Amount of memory allocated to this script is 478008 bytes
Names of included or required files:
- /var/www/vhosts/ar-php.org/httpdocs/I18N/Arabic/Examples/Soundex.php
- /var/www/vhosts/ar-php.org/httpdocs/I18N/Arabic.php
- /var/www/vhosts/ar-php.org/httpdocs/I18N/Arabic/Soundex.php
Related Class Documentation