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"); var_dump(1 % 3); var_dump(2 % 3); var_dump(3 % 3); var_dump(4 % 3); var_dump(5 % 3);
based on mkSmg
Output for 4.3.0 - 7.1.0
int(1) int(2) int(0) int(1) int(2)