1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function remplacer_Mots_Clefs($phrase)
{
$motsClefs = array('toast','toasts');
$md5MotsClefs = array(md5('toast'),md5('toasts'));
$motsRemplacants = array
('<a href="http://www.google.com/" title="toast">toast</a>',
'<a href="http://www.google.com/" title="toasts">toasts</a>');
$compteur = 0;
foreach ($motsClefs as $valeur)
{
$phrase = str_replace($motsClefs[$compteur], $md5MotsClefs[$compteur], $phrase);
$compteur++;
}
$compteur = 0;
foreach ($md5MotsClefs as $valeur)
{
$phrase = str_replace($md5MotsClefs[$compteur], $motsRemplacants[$compteur], $phrase);
$compteur++;
}
return $phrase;
} |
Partager