3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class IndexRange { /** * @param 0|positive-int $start * @param 0|positive-int $end */ public function __construct(public int $start, public int $end) { } } function acceptOne($a) {}; function acceptTwo($a, $b) {}; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $start = $i; $end = $i; acceptTwo($start, $end); } echo '2 vars: ' . round((microtime(true) - $t) * 1000, 2) . " ms\n"; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $rangeArr = [$i, $i]; acceptOne($rangeArr); } echo 'range arr: ' . round((microtime(true) - $t) * 1000, 2) . " ms\n"; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $rangeObj = new IndexRange($i, $i); acceptOne($rangeObj); } echo 'range obj: ' . round((microtime(true) - $t) * 1000, 2) . " ms\n";
Output for git.master
2 vars: 3.53 ms range arr: 8.87 ms range obj: 16.84 ms

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.47 ms | 405 KiB | 5 Q