note 103277 added to function.ord

From: Date: Tue, 05 Apr 2011 12:49:09 +0000
Subject: note 103277 added to function.ord
Groups: php.notes 
Request: Send a blank email to php-notes+get-178512@lists.php.net to get a copy of this message
i need put utf8 hungarian "abc" into html id attribute, but id not contain non-ascii chars (like á, ő, ű), and not to begin a number. <?php function utfCharToNumber($char) { $i = 0; $number = ''; while (isset($char{$i})) { $number.= ord($char{$i}); ++$i; } return $number; } // example use foreach (array('a','A','b','B','c','C','e','é','É', 'ó','Ó','ö','Ö','ő','Ő','ú') as $d) { echo $d,': ',utfCharToNumber($d),"\n"; } ?> output: a: 97 A: 65 b: 98 B: 66 c: 99 C: 67 e: 101 é: 195169 É: 195137 ó: 195179 Ó: 195147 ö: 195182 Ö: 195150 ő: 197145 Ő: 197144 ú: 195186 i generated the folowing ids: "char-97", "char-65", "char-98" ... ---- Server IP: 69.147.83.197 Probable Submitter: 145.236.215.201 ---- Manual Page -- http://www.php.net/manual/en/function.ord.php Edit -- https://master.php.net/note/edit/103277 Del: integrated -- https://master.php.net/note/delete/103277/integrated Del: useless -- https://master.php.net/note/delete/103277/useless Del: bad code -- https://master.php.net/note/delete/103277/bad+code Del: spam -- https://master.php.net/note/delete/103277/spam Del: non-english -- https://master.php.net/note/delete/103277/non-english Del: in docs -- https://master.php.net/note/delete/103277/in+docs Del: other reasons-- https://master.php.net/note/delete/103277 Reject -- https://master.php.net/note/reject/103277 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178512) next »