3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function encode($str) { $str = mb_convert_encoding($str , 'UTF-32', 'UTF-8'); //big endian $split = str_split($str, 4); $res = ""; foreach ($split as $c) { $cur = 0; for ($i = 0; $i < 4; $i++) { $cur |= ord($c[$i]) << (8*(3 - $i)); } $res .= "&#" . $cur . ";"; } return $res; } echo encode("mailto:liisa@finnanimation.fi");
based on ARgNe
Output for 5.0.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#108;&#105;&#105;&#115;&#97;&#64;&#102;&#105;&#110;&#110;&#97;&#110;&#105;&#109;&#97;&#116;&#105;&#111;&#110;&#46;&#102;&#105;
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/nBiC6 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/nBiC6 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/nBiC6 on line 4