3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function character_iterator ($str) { $len=strlen($str); for ($i=0;$i<$len;++$i) yield ord($str[$i]); } function code_point_iterator ($str) { $i=0; $cp=0; foreach (character_iterator(iconv('utf-8','utf-32be',$str)) as $b) { if ($i===4) { $i=0; yield $cp; $cp=0; } $cp<<=8; $cp|=$b; ++$i; } if ($i!==0) yield $cp; } foreach (code_point_iterator('Schei├če') as $cp) var_dump(\IntlChar::charName(\IntlChar::foldCase($cp))); ?>
based on IuCac
Output for 7.0.0 - 7.0.4, 7.0.20 - 7.2.0
string(20) "LATIN SMALL LETTER S" string(20) "LATIN SMALL LETTER C" string(20) "LATIN SMALL LETTER H" string(20) "LATIN SMALL LETTER E" string(20) "LATIN SMALL LETTER I" string(26) "LATIN SMALL LETTER SHARP S" string(20) "LATIN SMALL LETTER E"
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function iconv() in /in/JX7VY:14 Stack trace: #0 /in/JX7VY(33): code_point_iterator('Schei\xC3\x9Fe') #1 {main} thrown in /in/JX7VY on line 14
Process exited with code 255.
Output for 7.0.5
Fatal error: Uncaught Error: Class 'IntlChar' not found in /in/JX7VY:33 Stack trace: #0 {main} thrown in /in/JX7VY on line 33
Process exited with code 255.
Output for 5.5.24 - 5.5.34, 5.6.8 - 5.6.20, 5.6.28
Fatal error: Class 'IntlChar' not found in /in/JX7VY on line 33
Process exited with code 255.
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function iconv() in /in/JX7VY on line 14
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'ord' (T_STRING) in /in/JX7VY on line 6
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/JX7VY on line 6
Process exited with code 255.