3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //$var = 'A'; //$var = ''; //$var = null; $var = 0; $f1 = function($var) { if (! isset($var) || $var) { //echo "set default"; //"not empty or not defiend or a null value"; } else { //echo "not default"; //"empty"; } }; $f2 = function($var) { if (! isset($var) || ! empty($var)) { //echo "set default"; } else { //echo "not default"; } }; $s = microtime(1); for ($i = 0; $i < 100000; $i++) { $f1($var); } echo microtime(1) - $s; echo "\n"; $s = microtime(1); for ($i = 0; $i < 100000; $i++) { $f2($var); } echo microtime(1) - $s;
Output for 7.1.0
0.0046200752258301 0.0063111782073975
Output for 7.0.14
0.006925106048584 0.0094089508056641
Output for 7.0.12
0.0081198215484619 0.010884046554565
Output for 7.0.6
0.0072519779205322 0.0079350471496582
Output for 7.0.5
0.0068449974060059 0.0076379776000977
Output for 7.0.4
0.0069689750671387 0.0088050365447998
Output for 7.0.3
0.0090169906616211 0.0072050094604492
Output for 7.0.2
0.0043630599975586 0.005112886428833
Output for 7.0.1
0.0076091289520264 0.0073099136352539
Output for 7.0.0
0.0059809684753418 0.006817102432251
Output for 5.6.28
0.019156932830811 0.022786855697632
Output for 5.6.21
0.014703989028931 0.015292882919312
Output for 5.6.20
0.015055179595947 0.015568017959595
Output for 5.6.19
0.013276815414429 0.011851072311401
Output for 5.6.18
0.025253057479858 0.024300813674927
Output for 5.6.17
0.015626192092896 0.016195058822632
Output for 5.6.16
0.014688968658447 0.015225172042847
Output for 5.6.15
0.012511968612671 0.014153003692627
Output for 5.6.14
0.014976024627686 0.014703989028931
Output for 5.6.13
0.016163110733032 0.01618480682373
Output for 5.6.12
0.011952877044678 0.012000799179077
Output for 5.6.11
0.017630815505981 0.017888069152832
Output for 5.6.10
0.013513803482056 0.014425039291382
Output for 5.6.9
0.015707969665527 0.016149997711182
Output for 5.6.8
0.011451005935669 0.012093067169189
Output for 5.6.7
0.010329008102417 0.011631011962891
Output for 5.6.6
0.014235019683838 0.01504921913147
Output for 5.6.5
0.012122869491577 0.012529134750366
Output for 5.6.4
0.010349035263062 0.011416912078857
Output for 5.6.3
0.017517805099487 0.016280174255371
Output for 5.6.2
0.010188817977905 0.011680126190186
Output for 5.6.1
0.015942096710205 0.016386985778809
Output for 5.6.0
0.015902996063232 0.01697301864624
Output for 5.5.35
0.015235900878906 0.015608072280884
Output for 5.5.34
0.016324043273926 0.016731023788452
Output for 5.5.33
0.017605066299438 0.017864942550659
Output for 5.5.32
0.016089916229248 0.01640796661377
Output for 5.5.31
0.0099039077758789 0.011255979537964
Output for 5.5.30
0.016151905059814 0.016710042953491
Output for 5.5.29
0.015849113464355 0.016486883163452
Output for 5.5.28
0.01216983795166 0.012294054031372
Output for 5.5.27
0.012737035751343 0.013413906097412
Output for 5.5.26
0.017944812774658 0.017457008361816
Output for 5.5.25
0.014940023422241 0.01656699180603
Output for 5.5.24
0.012749910354614 0.013091087341309
Output for 5.5.23
0.010171890258789 0.013127088546753
Output for 5.5.22
0.011992931365967 0.012784004211426
Output for 5.5.21
0.01639986038208 0.017184972763062
Output for 5.5.20
0.013280868530273 0.014775991439819
Output for 5.5.19
0.010475873947144 0.011268138885498
Output for 5.5.18
0.010239839553833 0.012773990631104
Output for 5.5.16
0.014434099197388 0.015047073364258
Output for 5.5.15
0.010257005691528 0.011409997940063
Output for 5.5.14
0.015581846237183 0.016237020492554
Output for 5.5.13
0.01421594619751 0.014858961105347
Output for 5.5.12
0.015571117401123 0.014723062515259
Output for 5.5.11
0.010384798049927 0.01128101348877
Output for 5.5.10
0.014923095703125 0.015427112579346
Output for 5.5.9
0.016093969345093 0.016572952270508
Output for 5.5.8
0.01474404335022 0.014955997467041
Output for 5.5.7
0.016157150268555 0.016808986663818
Output for 5.5.6
0.010204076766968 0.011280059814453
Output for 5.5.5
0.015794038772583 0.016263961791992
Output for 5.5.4
0.010671854019165 0.011809825897217
Output for 5.5.3
0.016191959381104 0.016716003417969
Output for 5.5.2
0.011892795562744 0.012560844421387
Output for 5.5.1
0.016493082046509 0.016800165176392
Output for 5.5.0
0.010334014892578 0.011468887329102
Output for 5.4.45
0.015279054641724 0.01610803604126
Output for 5.4.44
0.014837980270386 0.015268802642822
Output for 5.4.43
0.017052173614502 0.019721984863281
Output for 5.4.42
0.012647867202759 0.013609886169434
Output for 5.4.41
0.015276908874512 0.015716075897217
Output for 5.4.40
0.015202045440674 0.01594090461731
Output for 5.4.39
0.011887073516846 0.012871980667114
Output for 5.4.38
0.014288187026978 0.014744997024536
Output for 5.4.37
0.0098068714141846 0.010897874832153
Output for 5.4.36
0.014096021652222 0.014719009399414
Output for 5.4.35
0.0098109245300293 0.011006832122803
Output for 5.4.34
0.009835958480835 0.010915994644165
Output for 5.4.32
0.01571798324585 0.016037940979004
Output for 5.4.31
0.015318155288696 0.015871047973633
Output for 5.4.30
0.015633106231689 0.016380071640015
Output for 5.4.29
0.01847505569458 0.015602111816406
Output for 5.4.28
0.015296936035156 0.016054153442383
Output for 5.4.27
0.014009952545166 0.014492034912109
Output for 5.4.26
0.012172937393188 0.012695074081421
Output for 5.4.25
0.015282869338989 0.015809059143066
Output for 5.4.24
0.015300989151001 0.015784025192261
Output for 5.4.23
0.015960931777954 0.016196966171265
Output for 5.4.22
0.0096778869628906 0.010784864425659
Output for 5.4.21
0.016947031021118 0.017153024673462
Output for 5.4.20
0.0098910331726074 0.01085901260376
Output for 5.4.19
0.01531195640564 0.015710115432739
Output for 5.4.18
0.015733957290649 0.016174077987671
Output for 5.4.17
0.011668920516968 0.011866807937622
Output for 5.4.16
0.01474404335022 0.01546311378479
Output for 5.4.15
0.01276707649231 0.01350212097168
Output for 5.4.14
0.01055383682251 0.010771989822388
Output for 5.4.13
0.012386083602905 0.013261795043945
Output for 5.4.12
0.016433000564575 0.016685009002686
Output for 5.4.11
0.015846014022827 0.016102075576782
Output for 5.4.10
0.010288000106812 0.01078987121582
Output for 5.4.9
0.015618085861206 0.01613712310791
Output for 5.4.8
0.010251998901367 0.010921955108643
Output for 5.4.7
0.016154050827026 0.016724109649658
Output for 5.4.6
0.013733863830566 0.014318943023682
Output for 5.4.5
0.016126155853271 0.015899181365967
Output for 5.4.4
0.011756181716919 0.011116981506348
Output for 5.4.3
0.013247013092041 0.013783931732178
Output for 5.4.2
0.016195058822632 0.016036987304688
Output for 5.4.1
0.015937805175781 0.016458988189697
Output for 5.4.0
0.014910936355591 0.016320943832397
Output for 5.3.29
0.016579866409302 0.016737937927246
Output for 5.3.28
0.017241954803467 0.017475843429565
Output for 5.3.27
0.011074066162109 0.012237071990967
Output for 5.3.26
0.017578125 0.016940832138062
Output for 5.3.25
0.011537075042725 0.01216197013855
Output for 5.3.24
0.011123895645142 0.012204170227051
Output for 5.3.23
0.011703968048096 0.013461112976074
Output for 5.3.22
0.017436981201172 0.015202045440674
Output for 5.3.21
0.018951892852783 0.017647981643677
Output for 5.3.20
0.015935897827148 0.014897108078003
Output for 5.3.19
0.01850700378418 0.018795013427734
Output for 5.3.18
0.015676021575928 0.017383098602295
Output for 5.3.17
0.019442081451416 0.018720865249634
Output for 5.3.16
0.017499923706055 0.018086910247803
Output for 5.3.15
0.016005039215088 0.01683497428894
Output for 5.3.14
0.016263008117676 0.017093896865845
Output for 5.3.13
0.015151977539062 0.015313148498535
Output for 5.3.12
0.017705917358398 0.018017053604126
Output for 5.3.11
0.014219999313354 0.013342142105103
Output for 5.3.10
0.016756057739258 0.014493942260742
Output for 5.3.9
0.018172979354858 0.018113136291504
Output for 5.3.8
0.014806032180786 0.015675067901611
Output for 5.3.7
0.01869010925293 0.019623994827271
Output for 5.3.6
0.016276121139526 0.017205953598022
Output for 5.3.5
0.015732049942017 0.017009973526001
Output for 5.3.4
0.015033960342407 0.015630960464478
Output for 5.3.3
0.012142896652222 0.012727975845337
Output for 5.3.2
0.019577980041504 0.019258975982666
Output for 5.3.1
0.01159405708313 0.01268196105957
Output for 5.3.0
0.01235294342041 0.01366114616394
Output for 5.2.3 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/bK4i6 on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected T_FUNCTION in <b>/in/bK4i6</b> on line <b>6</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected T_FUNCTION in <b>/in/bK4i6</b> on line <b>6</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/bK4i6</b> on line <b>6</b><br />
Process exited with code 255.