3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ITERATIONS', 10000000); $start = microtime(true); $var = 0; while ($var < ITERATIONS) { ++$var; } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'while', $stop - $start); $start = microtime(true); $var = 0; do { ++$var; } while ($var < ITERATIONS); $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'do-while', $stop - $start); $start = microtime(true); for ($var = 0; $var < ITERATIONS; ++$var) { //do nothing } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'for', $stop - $start);

preferences:
31.29 ms | 402 KiB | 5 Q