3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t = microtime(true); $array = []; for($i = 0; $i < 1000000; $i++) { $array[] = $i; } print "[] ".(microtime(true) - $t); print "\n"; $t = microtime(true); $array = []; for($i = 0; $i < 1000000; $i++) { array_push($array, $i); } print "array_push ".(microtime(true) - $t);
Output for 8.1.2
Fatal error: Out of memory (allocated 18878464) (tried to allocate 33554440 bytes) in /in/sekeV on line 6 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.1.1
[] 0.034077882766724 array_push 0.04951000213623
Output for 8.0.11
[] 0.035571098327637 array_push 0.050137042999268
Output for 8.0.10
[] 0.035725116729736 array_push 0.053563117980957
Output for 8.0.9
[] 0.034140110015869 array_push 0.049618005752563
Output for 8.0.8
[] 0.03378701210022 array_push 0.048716068267822
Output for 8.0.7
[] 0.033082008361816 array_push 0.048347949981689
Output for 8.0.6
[] 0.033298015594482 array_push 0.049053907394409
Output for 8.0.5
[] 0.033884048461914 array_push 0.048713207244873
Output for 8.0.3
[] 0.034150123596191 array_push 0.048570871353149
Output for 8.0.2
[] 0.033052921295166 array_push 0.048297882080078
Output for 8.0.1
[] 0.034451961517334 array_push 0.04891300201416
Output for 8.0.0
[] 0.033435106277466 array_push 0.048686027526855
Output for 7.4.29
[] 0.039090871810913 array_push 0.052376985549927
Output for 7.4.24
[] 0.035799026489258 array_push 0.04969310760498
Output for 7.4.23
[] 0.035292863845825 array_push 0.048935174942017
Output for 7.4.22
[] 0.035394906997681 array_push 0.051209926605225
Output for 7.4.21
[] 0.034626960754395 array_push 0.04991602897644
Output for 7.4.20
[] 0.034765958786011 array_push 0.048824071884155
Output for 7.4.19
[] 0.034742116928101 array_push 0.048983097076416
Output for 7.4.18
[] 0.034866094589233 array_push 0.048401832580566
Output for 7.4.16
[] 0.034754037857056 array_push 0.049420118331909
Output for 7.4.15
[] 0.03473687171936 array_push 0.048141956329346
Output for 7.4.14
[] 0.03567099571228 array_push 0.04981803894043
Output for 7.4.13
[] 0.035074949264526 array_push 0.050234079360962
Output for 7.4.12
[] 0.035429954528809 array_push 0.048989057540894
Output for 7.4.11
[] 0.034922122955322 array_push 0.048462867736816
Output for 7.4.10
[] 0.035248994827271 array_push 0.048830986022949
Output for 7.4.9
[] 0.034580945968628 array_push 0.048249006271362
Output for 7.4.8
[] 0.034748077392578 array_push 0.049939155578613
Output for 7.4.7
[] 0.035336017608643 array_push 0.050040006637573
Output for 7.4.6
[] 0.035367012023926 array_push 0.049911022186279
Output for 7.4.5
[] 0.035551071166992 array_push 0.049642086029053
Output for 7.4.4
[] 0.035926103591919 array_push 0.049462080001831
Output for 7.4.3
[] 0.036879062652588 array_push 0.049952983856201
Output for 7.4.2
[] 0.035536050796509 array_push 0.051431894302368
Output for 7.4.1
[] 0.035516023635864 array_push 0.051059007644653
Output for 7.4.0
[] 0.03461217880249 array_push 0.048918962478638
Output for 7.3.31
[] 0.035184144973755 array_push 0.050394058227539
Output for 7.3.30
[] 0.034984827041626 array_push 0.053018093109131
Output for 7.3.29
[] 0.038008213043213 array_push 0.049446105957031
Output for 7.3.28
[] 0.036335945129395 array_push 0.052371025085449
Output for 7.3.27
[] 0.034755945205688 array_push 0.050314903259277
Output for 7.3.26
[] 0.034029006958008 array_push 0.048341035842896
Output for 7.3.25
[] 0.034404039382935 array_push 0.052849054336548
Output for 7.3.24
[] 0.034855842590332 array_push 0.051713943481445
Output for 7.3.23
[] 0.034899950027466 array_push 0.052027940750122
Output for 7.3.22
[] 0.03569221496582 array_push 0.052815914154053
Output for 7.3.21
[] 0.035145998001099 array_push 0.053942203521729
Output for 7.3.20
[] 0.035770893096924 array_push 0.057347059249878
Output for 7.3.19
[] 0.035321950912476 array_push 0.05095911026001
Output for 7.3.18
[] 0.035319089889526 array_push 0.052332162857056
Output for 7.3.17
[] 0.035561084747314 array_push 0.052714109420776
Output for 7.3.16
[] 0.036233901977539 array_push 0.050122976303101
Output for 7.3.15
[] 0.035681962966919 array_push 0.052544116973877
Output for 7.3.14
[] 0.035243034362793 array_push 0.052021026611328
Output for 7.3.13
[] 0.034948110580444 array_push 0.052074909210205
Output for 7.3.12
[] 0.036468029022217 array_push 0.052551984786987
Output for 7.3.11
[] 0.035936832427979 array_push 0.052526950836182
Output for 7.3.10
[] 0.035243988037109 array_push 0.055459976196289
Output for 7.3.9
[] 0.035898923873901 array_push 0.053559064865112
Output for 7.3.8
[] 0.042412996292114 array_push 0.054966926574707
Output for 7.3.7
[] 0.035696029663086 array_push 0.055820941925049
Output for 7.3.6
[] 0.03450608253479 array_push 0.052036046981812
Output for 7.3.5
[] 0.034770011901855 array_push 0.053514957427979
Output for 7.3.4
[] 0.034469842910767 array_push 0.053645133972168
Output for 7.3.3
[] 0.034676074981689 array_push 0.05758810043335
Output for 7.3.2
[] 0.04497504234314 array_push 0.056446075439453
Output for 7.3.1
[] 0.060033082962036 array_push 0.061385869979858
Output for 7.3.0
[] 0.040825128555298 array_push 0.076035022735596

preferences:
42.27 ms | 515 KiB | 5 Q