3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("EOL", "<br />\n"); $m = 3; for($i = 0; $i <= $m; $i++){ $k = $i ? floor(log($i, $m)) : 0; $l = 0; for($o = $k; $o >= 0; $o--){ $l += pow($m, $k); } echo $l, EOL; }

preferences:
22.95 ms | 407 KiB | 5 Q