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 8.3.13
With array : 141.921827 ms With object: 115.799891 ms
Output for 8.3.12
With array : 146.654023 ms With object: 122.609651 ms
Output for 8.3.11
With array : 139.380925 ms With object: 124.37569 ms
Output for 8.3.10
With array : 138.379102 ms With object: 118.269087 ms
Output for 8.3.9
With array : 136.133909 ms With object: 112.602453 ms
Output for 8.3.8
With array : 185.39507 ms With object: 182.620364 ms
Output for 8.3.7
With array : 258.692546 ms With object: 219.366139 ms
Output for 8.3.6
With array : 260.377906 ms With object: 221.348476 ms
Output for 8.3.5
With array : 222.625421 ms With object: 134.090276 ms
Output for 8.3.4
With array : 265.752007 ms With object: 218.903662 ms
Output for 8.3.3
With array : 280.238032 ms With object: 233.956651 ms
Output for 8.3.2
With array : 146.592855 ms With object: 123.882543 ms
Output for 8.3.1
With array : 160.565065 ms With object: 106.884514 ms
Output for 8.3.0
With array : 162.533674 ms With object: 152.436167 ms
Output for 8.2.25
With array : 140.049925 ms With object: 146.156155 ms
Output for 8.2.24
With array : 180.504662 ms With object: 108.367576 ms
Output for 8.2.23
With array : 137.090291 ms With object: 118.041875 ms
Output for 8.2.22
With array : 138.908833 ms With object: 125.195691 ms
Output for 8.2.21
With array : 142.698337 ms With object: 103.929747 ms
Output for 8.2.20
With array : 167.704483 ms With object: 155.147497 ms
Output for 8.2.19
With array : 282.872153 ms With object: 200.828849 ms
Output for 8.2.18
With array : 267.073239 ms With object: 218.36861 ms
Output for 8.2.17
With array : 267.611171 ms With object: 200.90467 ms
Output for 8.2.16
With array : 277.478956 ms With object: 197.585763 ms
Output for 8.2.15
With array : 148.397052 ms With object: 127.783713 ms
Output for 8.2.14
With array : 138.482398 ms With object: 118.670601 ms
Output for 8.2.13
With array : 163.452144 ms With object: 118.441455 ms
Output for 8.2.12
With array : 140.688048 ms With object: 126.383194 ms
Output for 8.2.11
With array : 355.116087 ms With object: 251.285232 ms
Output for 8.2.10
With array : 190.890191 ms With object: 149.628508 ms
Output for 8.2.9
With array : 228.726043 ms With object: 188.788664 ms
Output for 8.2.8
With array : 186.534783 ms With object: 164.233663 ms
Output for 8.2.7
With array : 200.531279 ms With object: 149.288861 ms
Output for 8.2.6
With array : 190.118814 ms With object: 149.774569 ms
Output for 8.2.5
With array : 195.096407 ms With object: 149.572173 ms
Output for 8.2.4
With array : 189.365632 ms With object: 149.248795 ms
Output for 8.2.3
With array : 197.134233 ms With object: 150.211903 ms
Output for 8.2.2
With array : 241.796686 ms With object: 184.194921 ms
Output for 8.2.1
With array : 200.444564 ms With object: 151.756271 ms
Output for 8.2.0
With array : 206.237346 ms With object: 150.52573 ms
Output for 8.1.30
With array : 156.571715 ms With object: 124.110427 ms
Output for 8.1.29
With array : 179.091004 ms With object: 160.572932 ms
Output for 8.1.28
With array : 287.048714 ms With object: 223.393108 ms
Output for 8.1.27
With array : 147.520041 ms With object: 112.199357 ms
Output for 8.1.26
With array : 171.587723 ms With object: 136.081458 ms
Output for 8.1.25
With array : 166.3603 ms With object: 129.685127 ms
Output for 8.1.24
With array : 340.205813 ms With object: 232.280325 ms
Output for 8.1.23
With array : 192.689019 ms With object: 157.164036 ms
Output for 8.1.22
With array : 197.190923 ms With object: 171.537924 ms
Output for 8.1.21
With array : 188.648852 ms With object: 157.173895 ms
Output for 8.1.20
With array : 198.415713 ms With object: 172.025774 ms
Output for 8.1.19
With array : 201.021683 ms With object: 176.684116 ms
Output for 8.1.18
With array : 189.386164 ms With object: 156.892989 ms
Output for 8.1.17
With array : 192.642385 ms With object: 169.83954 ms
Output for 8.1.16
With array : 197.186026 ms With object: 162.281605 ms
Output for 8.1.15
With array : 191.414708 ms With object: 156.273174 ms
Output for 8.1.14
With array : 207.063968 ms With object: 173.458073 ms
Output for 8.1.13
With array : 188.724086 ms With object: 156.540167 ms
Output for 8.1.12
With array : 189.269301 ms With object: 160.888541 ms
Output for 8.1.11
With array : 193.736877 ms With object: 158.000492 ms
Output for 8.1.10
With array : 244.010179 ms With object: 172.288723 ms
Output for 8.1.9
With array : 196.822647 ms With object: 161.047047 ms
Output for 8.1.8
With array : 204.804897 ms With object: 170.910515 ms
Output for 8.1.7
With array : 190.116623 ms With object: 159.521286 ms
Output for 8.1.6
With array : 328.387998 ms With object: 235.029445 ms
Output for 8.1.5
With array : 328.24188 ms With object: 234.695793 ms
Output for 8.1.4
With array : 327.662078 ms With object: 234.651347 ms
Output for 8.1.3
With array : 329.578188 ms With object: 234.350066 ms
Output for 8.1.2
With array : 328.395975 ms With object: 234.642427 ms
Output for 8.1.1
With array : 337.537966 ms With object: 235.354192 ms
Output for 8.1.0
With array : 329.147752 ms With object: 234.053796 ms
Output for 8.0.30
With array : 212.556731 ms With object: 159.796044 ms
Output for 8.0.29
With array : 191.897326 ms With object: 156.387895 ms
Output for 8.0.28
With array : 194.083424 ms With object: 155.57629 ms
Output for 8.0.27
With array : 198.681885 ms With object: 166.710554 ms
Output for 8.0.26
With array : 198.232835 ms With object: 162.717294 ms
Output for 8.0.25
With array : 193.470287 ms With object: 156.171488 ms
Output for 8.0.24
With array : 195.592275 ms With object: 157.990001 ms
Output for 8.0.23
With array : 221.926898 ms With object: 156.456282 ms
Output for 8.0.22
With array : 195.256561 ms With object: 165.17301 ms
Output for 8.0.21
With array : 193.168357 ms With object: 171.915842 ms
Output for 8.0.20
With array : 214.967397 ms With object: 176.8464 ms
Output for 8.0.19
With array : 329.166849 ms With object: 238.737988 ms
Output for 8.0.18
With array : 331.212177 ms With object: 247.951246 ms
Output for 8.0.17
With array : 329.966565 ms With object: 241.538243 ms
Output for 8.0.16
With array : 329.643384 ms With object: 234.605433 ms
Output for 8.0.15
With array : 331.461016 ms With object: 234.724717 ms
Output for 8.0.14
With array : 329.873408 ms With object: 235.895022 ms
Output for 8.0.13
With array : 386.641941 ms With object: 275.05253 ms
Output for 8.0.12
With array : 330.211142 ms With object: 235.24649 ms
Output for 8.0.11
With array : 329.819629 ms With object: 235.238565 ms
Output for 8.0.10
With array : 329.038793 ms With object: 235.38122 ms
Output for 8.0.9
With array : 329.859976 ms With object: 235.608299 ms
Output for 8.0.8
With array : 504.912695 ms With object: 370.192714 ms
Output for 8.0.7
With array : 331.671408 ms With object: 235.580713 ms
Output for 8.0.6
With array : 329.851029 ms With object: 235.741688 ms
Output for 8.0.5
With array : 328.082506 ms With object: 234.860925 ms
Output for 8.0.3
With array : 292.915014 ms With object: 211.027365 ms
Output for 8.0.2
With array : 498.942042 ms With object: 406.908553 ms
Output for 8.0.1
With array : 343.788459 ms With object: 235.919337 ms
Output for 8.0.0
With array : 495.785243 ms With object: 399.702575 ms
Output for 7.4.33
With array : 212.258952 ms With object: 161.821264 ms
Output for 7.4.32
With array : 207.327486 ms With object: 161.163554 ms
Output for 7.4.30
With array : 206.479553 ms With object: 161.114101 ms
Output for 7.4.29
With array : 348.760447 ms With object: 239.975236 ms
Output for 7.4.28
With array : 353.779341 ms With object: 245.403907 ms
Output for 7.4.27
With array : 345.966492 ms With object: 239.039405 ms
Output for 7.4.26
With array : 345.909178 ms With object: 238.600079 ms
Output for 7.4.25
With array : 346.743988 ms With object: 238.452109 ms
Output for 7.4.24
With array : 352.024499 ms With object: 241.602839 ms
Output for 7.4.23
With array : 346.188198 ms With object: 239.164575 ms
Output for 7.4.22
With array : 346.396451 ms With object: 242.006816 ms
Output for 7.4.21
With array : 487.497542 ms With object: 465.695296 ms
Output for 7.4.20
With array : 349.152058 ms With object: 238.741556 ms
Output for 7.4.13
With array : 517.309035 ms With object: 472.652651 ms
Output for 7.4.12
With array : 550.420646 ms With object: 449.617475 ms
Output for 7.4.11
With array : 511.168104 ms With object: 413.644061 ms
Output for 7.4.10
With array : 763.968185 ms With object: 584.870752 ms
Output for 7.4.9
With array : 483.961629 ms With object: 415.709419 ms
Output for 7.4.8
With array : 477.155648 ms With object: 412.975826 ms
Output for 7.4.7
With array : 799.477797 ms With object: 494.676747 ms
Output for 7.4.6
With array : 500.450032 ms With object: 553.017853 ms
Output for 7.4.5
With array : 420.754786 ms With object: 306.975346 ms
Output for 7.4.4
With array : 801.447391 ms With object: 505.91219 ms
Output for 7.4.0
With array : 521.819687 ms With object: 454.340848 ms
Output for 7.3.33
With array : 337.104625 ms With object: 283.54253 ms
Output for 7.3.32
With array : 337.928645 ms With object: 284.228109 ms
Output for 7.3.31
With array : 337.138315 ms With object: 283.757843 ms
Output for 7.3.30
With array : 337.913033 ms With object: 286.559475 ms
Output for 7.3.29
With array : 337.08278 ms With object: 282.930438 ms
Output for 7.3.28
With array : 587.058597 ms With object: 495.875993 ms
Output for 7.3.26
With array : 784.191371 ms With object: 631.623701 ms
Output for 7.3.24
With array : 558.30994 ms With object: 497.211075 ms
Output for 7.3.23
With array : 518.983159 ms With object: 534.633358 ms
Output for 7.3.21
With array : 525.798396 ms With object: 486.140705 ms
Output for 7.3.20
With array : 553.676428 ms With object: 484.585455 ms
Output for 7.3.19
With array : 515.893534 ms With object: 491.905888 ms
Output for 7.3.18
With array : 533.452134 ms With object: 463.126062 ms
Output for 7.3.17
With array : 630.290026 ms With object: 504.332041 ms
Output for 7.3.16
With array : 566.529784 ms With object: 480.313623 ms
Output for 7.3.12
With array : 419.052271 ms With object: 381.176526 ms
Output for 7.3.11
With array : 470.448278 ms With object: 375.610818 ms
Output for 7.3.10
With array : 599.33855 ms With object: 440.319154 ms
Output for 7.3.9
With array : 458.268081 ms With object: 395.413645 ms
Output for 7.3.8
With array : 602.215943 ms With object: 446.661386 ms
Output for 7.3.7
With array : 414.506804 ms With object: 357.515404 ms
Output for 7.3.6
With array : 473.752363 ms With object: 510.864083 ms
Output for 7.3.5
With array : 454.352326 ms With object: 421.028001 ms
Output for 7.3.4
With array : 428.173375 ms With object: 355.249148 ms
Output for 7.3.3
With array : 598.628031 ms With object: 373.722636 ms
Output for 7.3.2
With array : 530.669571 ms With object: 379.134173 ms
Output for 7.3.1
With array : 520.102204 ms With object: 416.456709 ms
Output for 7.3.0
With array : 525.196958 ms With object: 345.160375 ms
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Uncaught Error: Call to undefined function hrtime() in /in/3TBfX:16 Stack trace: #0 {main} thrown in /in/3TBfX on line 16
Process exited with code 255.

preferences:
121.01 ms | 632 KiB | 5 Q