note 49336 deleted from function.utf8-encode by cmb

From: Date: Sun, 22 Dec 2019 09:03:28 +0000
Subject: note 49336 deleted from function.utf8-encode by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213584@lists.php.net to get a copy of this message
Note Submitter: anonymous at anonymous dot com ---- A few bugs in your example code: function code2utf($num){ if($num<128)return chr($num); if($num<2048)return chr(($num>>6)+192).chr(($num&63)+128); if($num<65536)return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128); if($num<2097152)return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128) .chr(($num&63)+128); return ''; }

« previous php.notes (#213584) next »