3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _uniord($c) { if (ord($c{0}) >=0 && ord($c{0}) <= 127) return ord($c{0}); if (ord($c{0}) >= 192 && ord($c{0}) <= 223) return (ord($c{0})-192)*64 + (ord($c{1})-128); if (ord($c{0}) >= 224 && ord($c{0}) <= 239) return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); if (ord($c{0}) >= 240 && ord($c{0}) <= 247) return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); if (ord($c{0}) >= 248 && ord($c{0}) <= 251) return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); if (ord($c{0}) >= 252 && ord($c{0}) <= 253) return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); if (ord($c{0}) >= 254 && ord($c{0}) <= 255) // error return FALSE; return 0; } var_dump(_uniord('А')); $line = "Какова сумма номеров символов Unicode во всем этом вопросе?"; for($i = 0; $i < mb_strlen($line); $i++) { var_dump($line[$i]); }
Output for git.master, git.master_jit
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/S1rki on line 4
Process exited with code 255.
Output for rfc.property-hooks
Parse error: syntax error, unexpected token "{", expecting ")" in /in/S1rki on line 4
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:
58.3 ms | 401 KiB | 8 Q