3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IndexRange { /** @var 0|positive-int */ public int $start; /** @var 0|positive-int */ public int $end; /** * @param 0|positive-int $start * @param 0|positive-int $end */ public function __construct(int $start = null, int $end = null) { if (null !== $start) { $this->start = $start; } if (null !== $end) { $this->end = $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.49 ms range arr: 9.12 ms range obj: 18.05 ms
Output for git.master_jit
2 vars: 3.6 ms range arr: 9.39 ms range obj: 17.6 ms
Output for rfc.property-hooks
2 vars: 1.3 ms range arr: 3.52 ms range obj: 7.19 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:
91.23 ms | 407 KiB | 5 Q