3v4l.org

run code in 300+ PHP versions simultaneously
<?php $isset = true; $array = array(); $notSetArray = array(0=>''); $string = ''; // Test Source function TestEmpty() { $array = null; $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { !empty($array); ++$i; } echo (microtime(true) - $t); } function TestEmpty2() { $array = null; $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { (! $array ); ++$i; } echo (microtime(true) - $t); } function TestEmpty3() { $array = null; $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { ($array != []); ++$i; } echo (microtime(true) - $t); } function TestEmpty4() { $array = null; $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { ((array)$array === $array); ++$i; } echo (microtime(true) - $t); } TestEmpty(); echo "\n\n"; TestEmpty2(); echo "\n\n"; TestEmpty3(); echo "\n\n"; TestEmpty4();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.00.0040.01515.16
7.3.120.0030.01114.91
7.3.110.0070.01014.63
7.3.100.0070.00715.07
7.3.90.0120.00315.12
7.3.80.0030.01014.61
7.3.70.0070.00715.09
7.3.60.0040.01114.68
7.3.50.0000.01814.63
7.3.40.0070.00714.81
7.3.30.0040.01214.80
7.3.20.0040.01116.83
7.3.10.0060.00916.66
7.3.00.0020.01016.66
7.2.250.0060.00915.32
7.2.240.0060.01214.91
7.2.230.0070.00415.01
7.2.220.0050.00515.00
7.2.210.0090.00614.88
7.2.200.0130.00314.86
7.2.190.0180.00015.09
7.2.180.0030.01415.04
7.2.170.0060.01215.02
7.2.130.0030.01016.86
7.2.120.0070.00716.81
7.2.110.0060.00916.80
7.2.100.0040.00816.96
7.2.90.0000.01117.07
7.2.80.0030.00616.84
7.2.70.0090.00316.89
7.2.60.0070.00716.95
7.2.50.0100.00316.96
7.2.40.0000.01416.63
7.2.30.0070.00716.79
7.2.20.0060.00617.01
7.2.10.0030.01217.05
7.2.00.0020.01018.14
7.1.330.0120.00315.43
7.1.320.0090.00415.75
7.1.310.0000.01615.88
7.1.300.0030.01215.85
7.1.290.0040.01115.91
7.1.280.0040.01115.70
7.1.270.0060.00815.69
7.1.260.0060.00915.62
7.1.250.0000.01316.00
7.1.70.0130.00017.09
7.1.60.0100.00619.39
7.1.50.0130.00917.02
7.1.00.0070.07322.51
7.0.200.0140.00316.79
7.0.140.0070.07021.97
7.0.60.0000.08319.86
7.0.50.0030.05317.88
7.0.40.0170.05720.11
7.0.30.0330.04020.09
7.0.20.0300.08320.24
7.0.10.0030.04720.06
7.0.00.0030.09020.12
5.6.280.0030.07320.83
5.6.210.0070.09020.54
5.6.200.0100.07318.29
5.6.190.0100.04720.51
5.6.180.0270.07020.61
5.6.170.0470.07020.62
5.6.160.0000.04320.54
5.6.150.0070.04718.20
5.6.140.0030.08718.16
5.6.130.0000.05718.25
5.6.120.0070.09020.99
5.6.110.0000.04321.05
5.6.100.0170.07320.98
5.6.90.0030.04021.11
5.6.80.0070.08020.50
5.6.70.4100.03720.43
5.5.350.0100.06020.42
5.5.340.0070.04017.98
5.5.330.0000.05320.37
5.5.320.0030.08320.20
5.5.310.0230.06320.37
5.5.300.0070.03717.99
5.5.290.0030.05018.08
5.5.280.0070.06720.78
5.5.270.0030.05320.73
5.5.260.0100.09020.89
5.5.250.0100.03720.58
5.5.240.0330.06720.06
5.4.450.0100.07019.62
5.4.440.0700.05319.34
5.4.430.0130.05319.45
5.4.420.0870.04719.72
5.4.410.0800.05319.57
5.4.400.0670.05019.38
5.4.390.0770.08019.15
5.4.380.0300.05718.61
5.4.370.0300.07018.76
5.4.360.0400.07018.70
5.4.350.0270.06318.63
5.4.340.0300.05718.62
5.4.320.0070.03612.50
5.4.310.0060.03712.50
5.4.300.0040.05012.51
5.4.290.0060.03912.50
5.4.280.0080.05412.38
5.4.270.0100.04612.38
5.4.260.0120.06512.38
5.4.250.0060.06612.38
5.4.240.0050.05312.38
5.4.230.0100.05512.38
5.4.220.0240.05512.37
5.4.210.0070.06312.37
5.4.200.0120.04712.37
5.4.190.0100.06012.37
5.4.180.0090.05712.37
5.4.170.0150.05512.38
5.4.160.0080.05212.38
5.4.150.0090.05112.37
5.4.140.0130.04812.05
5.4.130.0090.05112.04
5.4.120.0140.04612.00
5.4.110.0080.05811.99
5.4.100.0090.04911.99
5.4.90.0120.05411.99
5.4.80.0100.05311.99
5.4.70.0070.06311.99
5.4.60.0190.06911.99
5.4.50.0100.05911.99
5.4.40.0160.06411.98
5.4.30.0110.05011.97
5.4.20.0050.06011.97
5.4.10.0100.05011.98
5.4.00.0090.05511.46
5.3.290.0060.04112.80
5.3.280.0120.05112.71
5.3.270.0090.06312.72
5.3.260.0100.05712.72
5.3.250.0100.05812.72
5.3.240.0100.05812.72
5.3.230.0180.06312.71
5.3.220.0090.05612.68
5.3.210.0130.05112.68
5.3.200.0140.05712.68
5.3.190.0100.03512.68
5.3.180.0130.03712.68
5.3.170.0180.06112.67
5.3.160.0110.05412.68
5.3.150.0120.05212.68
5.3.140.0110.05312.66
5.3.130.0130.05312.66
5.3.120.0100.05812.66
5.3.110.0120.05512.65
5.3.100.0320.12312.12
5.3.90.0300.08712.09
5.3.80.0090.06412.07
5.3.70.0120.08412.08
5.3.60.0170.06212.07
5.3.50.0200.05612.00
5.3.40.0120.06312.00
5.3.30.0090.05611.96
5.3.20.0130.04711.75
5.3.10.0180.05611.70
5.3.00.0110.05411.70
5.2.170.0140.0569.19
5.2.160.0180.0849.20
5.2.150.0130.0549.20
5.2.140.0200.0519.19
5.2.130.0120.0599.15
5.2.120.0140.0489.15
5.2.110.0030.0439.16
5.2.100.0140.0549.16
5.2.90.0120.0699.15
5.2.80.0040.0469.15
5.2.70.0110.0489.15
5.2.60.0120.0519.11
5.2.50.0080.0409.08
5.2.40.0080.0439.06
5.2.30.0140.0599.02
5.2.20.0090.0379.01
5.2.10.0070.0408.92
5.2.00.0130.0518.80
5.1.60.0050.0388.07
5.1.50.0060.0328.08
5.1.40.0090.0328.05
5.1.30.0100.0398.40
5.1.20.0060.0418.43
5.1.10.0090.0458.16
5.1.00.0050.0398.16
5.0.50.0060.0286.63
5.0.40.0050.0286.50
5.0.30.0060.0426.30
5.0.20.0020.0296.27
5.0.10.0050.0296.25
5.0.00.0060.0396.25
4.4.90.0030.0244.78
4.4.80.0020.0244.76
4.4.70.0030.0184.76
4.4.60.0020.0184.76
4.4.50.0050.0254.77
4.4.40.0040.0264.71
4.4.30.0040.0174.76
4.4.20.0040.0234.84
4.4.10.0050.0174.85
4.4.00.0040.0334.76
4.3.110.0060.0224.67
4.3.100.0060.0214.66
4.3.90.0030.0234.64
4.3.80.0040.0374.58
4.3.70.0070.0214.63
4.3.60.0060.0214.63
4.3.50.0040.0304.62
4.3.40.0100.0274.53
4.3.30.0060.0263.30
4.3.20.0050.0193.29
4.3.10.0030.0253.25
4.3.00.0000.01710.30

preferences:
38 ms | 401 KiB | 5 Q