3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [ "a" => 1, "b" => "hello", "c" => 5.5, "d" => true, ]; $y = new stdClass(); $y->a = 1; $y->b = "hello"; $y->c = 5.5; $y->d = true; $t1 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { $a = $x["a"]; $b = $x["b"]; $c = $x["c"]; $d = $x["d"]; } $t2 = hrtime(true); $t3 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { $a = $y->a; $b = $y->b; $c = $y->c; $d = $y->d; } $t4 = hrtime(true); echo "With array : " . (($t2 - $t1) / 1000000) . " ms\n"; echo "With object: " . (($t4 - $t3) / 1000000) . " ms\n"; class A { public $a; public $b; public $c; public $d; }
Output for git.master
With array : 197.167129 ms With object: 151.514038 ms
Output for git.master_jit
With array : 218.900242 ms With object: 161.313117 ms
Output for rfc.property-hooks
With array : 152.364794 ms With object: 118.514395 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:
27.52 ms | 407 KiB | 5 Q