3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // calculate sum of ordinal values of chars // starting from $start until the end of $str function charsum($str, $start) { $sum = 0; for ($i = $start, $max = strlen($str); $i < $max; ++$i) { $sum += ord($str[$i]); } return $sum; } $str = 'hello world'; echo charsum($str, strpos($str, ' ')); $x = false; echo $str[(int)$x]; // sh/b h
Output for 4.3.0 - 5.0.5, 5.1.1 - 7.1.0
584h
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/QEeKQ on line 18
Process exited with code 255.