3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function msubstr($str, $start, $len) { $tmpstr = ""; $strlen = $start + $len; for($i = 0; $i < $strlen; $i++) { if(ord(substr($str, $i, 1)) > 0xa0) { $tmpstr .= substr($str, $i, 2); $i++; } else $tmpstr .= substr($str, $i, 1); } return $tmpstr; } var_dump(); // $a = '测试这是一个测试'; $a = 'xxxxbbbbbnnn'; $b = msubstr($a,0,5); var_dump($b); ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: var_dump() expects at least 1 parameter, 0 given in /in/phjiA on line 16 string(5) "xxxxb"
Output for hhvm-3.10.0 - 3.12.0
Warning: var_dump() expects exactly 1 parameter, 0 given in /in/phjiA on line 16 string(5) "xxxxb"
Output for 4.3.0 - 5.2.17
Warning: Wrong parameter count for var_dump() in /in/phjiA on line 16 string(5) "xxxxb"