note 29114 added to function.str-replace
| From: | rbourgeois at netcourrier dot com | Date: | Mon, 03 Feb 2003 09:36:08 +0000 |
| Subject: | note 29114 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43318@lists.php.net to get a copy of this message | ||
Pratique quand on affiche les pages au format UTF8, ou tout autre format qui ne reconnait pas les
caractères accntués.
Compléter les deux arrays selon les besoins.
/**
* Convertit les accents en entités HTML
* @param string $strTexte : chaine à traiter
* @return string chaine traitée
* @author Raf
*/
function convertToHtml($strTexte) {
$arrSearch = Array (
'é',
'è',
'ë',
'ê',
'à',
'ä',
'â',
'ù',
'ü',
'û',
'ö',
'ô',
'ï',
'î');
$arrReplace = Array(
'é',
'è',
'ë',
'ê',
'à',
'ä',
'â',
'ù',
'ü',
'û',
'ö',
'ô',
'ï',
'î');
$strReturn = str_replace($arrSearch, $arrReplace, $strTexte);
return $strReturn;
}
--
http://www.php.net/manual/en/function.str-replace.php
http://master.php.net/manage/user-notes.php?action=edit+29114
http://master.php.net/manage/user-notes.php?action=delete+29114
http://master.php.net/manage/user-notes.php?action=reject+29114