3v4l.org

run code in 300+ PHP versions simultaneously
<?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, ' '));

preferences:
38.26 ms | 402 KiB | 5 Q