3v4l.org

run code in 300+ PHP versions simultaneously
<?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('á'); 225 //echo utf8(0xE1); á $strTest='holá'; for($i = 0, $n = mb_strlen($strTest); $i < $n; $i++) { $mbchar = mb_substr($strUTF8, $i, 1); echo 'current char: '.$mbchar.'\n<br\>'; echo 'uniord= '.uniord($mbchar).'\n<br\>'; echo 'prev char= '.utf8(dechex(uniord($mbchar)-1)).'\n<br\>'.'\n<br\>'; }
Output for git.master, git.master_jit
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/3U2Sq on line 13
Process exited with code 255.
Output for rfc.property-hooks
Parse error: syntax error, unexpected token "{", expecting ")" in /in/3U2Sq on line 13
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.82 ms | 401 KiB | 8 Q