note 91262 added to function.htmlentities

From: Date: Tue, 02 Jun 2009 16:57:55 +0000
Subject: note 91262 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-156298@lists.php.net to get a copy of this message
Here's a simple function to convert the ASCII code to it's character equivalent in a string (especially useful for french accent): function ascii_trans($string){ function ascii_switch($matches){ return chr(substr($matches[0], 2, -1)); } return preg_replace_callback("/&#[0-9][0-9][0-9];|&#[0-9][0-9];/", "ascii_switch", $string); } echo ascii_trans("C’est pas compliqué"); return C'est pas compliqué ---- Server IP: 66.207.199.35 Probable Submitter: 207.253.241.9 ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- https://master.php.net/note/edit/91262 Del: integrated -- https://master.php.net/note/delete/91262/integrated Del: useless -- https://master.php.net/note/delete/91262/useless Del: bad code -- https://master.php.net/note/delete/91262/bad+code Del: spam -- https://master.php.net/note/delete/91262/spam Del: non-english -- https://master.php.net/note/delete/91262/non-english Del: in docs -- https://master.php.net/note/delete/91262/in+docs Del: other reasons-- https://master.php.net/note/delete/91262 Reject -- https://master.php.net/note/reject/91262 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156298) next »