3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function utf8($num) { if($num<=0x7F) return chr($num); if($num<=0x7FF) return chr(($num>>6)+192).chr(($num&63)+128); if($num<=0xFFFF) return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128); if($num<=0x1FFFFF) return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128).chr(($num&63)+128); return ''; } function uniord($c) { $ord0 = ord($c{0}); if ($ord0>=0 && $ord0<=127) return $ord0; $ord1 = ord($c{1}); if ($ord0>=192 && $ord0<=223) return ($ord0-192)*64 + ($ord1-128); $ord2 = ord($c{2}); if ($ord0>=224 && $ord0<=239) return ($ord0-224)*4096 + ($ord1-128)*64 + ($ord2-128); $ord3 = ord($c{3}); if ($ord0>=240 && $ord0<=247) return ($ord0-240)*262144 + ($ord1-128)*4096 + ($ord2-128)*64 + ($ord3-128); return false; } echo uniord(á);
Output for 7.2.0 - 7.2.6
Warning: Use of undefined constant á - assumed 'á' (this will throw an Error in a future version of PHP) in /in/2Y8BV on line 19 225
Output for 4.3.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.1.20
Notice: Use of undefined constant á - assumed 'á' in /in/2Y8BV on line 19 225