3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(0 => true, 8 => true, 16 => true, 32 => true, 64 => true, 128 => true, 256 => true, 256 => 'foo'); $array = array('foo', true, true, true, true, true, true, 'foo'); ini_set('precision', 12); echo "Test with hash collisions\n"; for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); isset($arr[256]); $t = microtime(true) - $t; $r[] = $t; } array_pop($r); array_shift($r); printf("isset() test avg(10K): %.12f\n", array_sum($r) / count($r)); for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); in_array('foo', $arr); $t = microtime(true) - $t; $rr[] = $t; } array_pop($rr); array_shift($rr); printf("in_array() test avg(10K): %.12f \n", array_sum($rr) / count($rr)); echo "\n\nTests without hash collisions\n"; /* Without hash collisions */ for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); isset($array[7]); $t = microtime(true) - $t; $r[] = $t; } printf("isset() test avg(10K): %.12f\n", array_sum($r) / count($r)); for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); in_array('foo', $array); $t = microtime(true) - $t; $rr[] = $t; } printf("in_array() test avg(10K): %.12f \n", array_sum($rr) / count($rr));

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.0030.02617.01
7.3.120.0140.01717.18
7.3.110.0000.01916.95
7.3.100.0030.02116.81
7.3.90.0040.01916.92
7.3.80.0000.02617.02
7.3.70.0100.01716.82
7.3.60.0090.01616.96
7.3.50.0030.02316.96
7.3.40.0000.02816.95
7.3.30.0030.01916.89
7.3.20.0070.01720.45
7.3.10.0200.00320.34
7.3.00.0040.01520.41
7.2.250.0090.02216.85
7.2.240.0070.02416.96
7.2.230.0100.02017.09
7.2.220.0070.01317.02
7.2.210.0110.01416.92
7.2.200.0030.02017.07
7.2.190.0110.01517.15
7.2.180.0100.01716.99
7.2.170.0130.00717.15
7.2.00.0000.02122.95
7.1.330.0070.02719.99
7.1.320.0070.02219.71
7.1.310.0130.01719.41
7.1.300.0030.02819.70
7.1.290.0100.02319.73
7.1.280.0060.02219.42
7.1.270.0060.02519.78
7.1.260.0000.03219.74
7.1.70.0030.01321.21
7.1.60.0140.02720.95
7.1.50.0140.02420.54
7.1.00.0030.09026.33
7.0.200.0030.01820.92
7.0.140.0070.08726.15
7.0.60.0070.09722.05
7.0.50.0070.07719.87
7.0.40.0070.07320.31
7.0.30.0270.07720.12
7.0.20.0200.05320.12
7.0.10.0270.08320.18
7.0.00.0030.05020.16
5.6.280.0000.10726.67
5.6.210.0100.07026.28
5.6.200.0100.08323.61
5.6.190.0030.10726.00
5.6.180.3500.05725.97
5.6.170.0270.06726.03
5.6.160.0070.09026.00
5.6.150.0000.06723.70
5.6.140.0130.10023.79
5.6.130.0030.11023.84
5.6.120.0130.08726.73
5.6.110.0100.09326.72
5.6.100.0130.05026.81
5.6.90.0170.09726.71
5.6.80.0170.10026.21
5.6.70.0270.05326.11
5.5.350.0170.06026.00
5.5.340.0100.09723.57
5.5.330.0170.05325.83
5.5.320.0200.08025.74
5.5.310.0370.09325.71
5.5.300.0130.10023.61
5.5.290.0070.06023.57
5.5.280.0100.07026.55
5.5.270.0070.06026.56
5.5.260.0100.11026.44
5.5.250.0030.11026.38
5.5.240.0170.07725.96
5.4.450.0330.07024.80
5.4.440.0630.10725.07
5.4.430.0730.08724.73
5.4.420.1000.00025.09
5.4.410.0270.07324.65
5.4.400.0200.09024.41
5.4.390.0230.09024.34
5.4.380.0300.08024.20
5.4.370.0270.08024.16
5.4.360.0300.05724.34
5.4.350.0190.05817.65
5.4.340.0230.05017.65
5.4.320.0110.06518.14
5.4.310.0120.06318.13
5.4.300.0130.05818.14
5.4.290.0130.05818.13
5.4.280.0140.06118.03
5.4.270.0120.06818.03
5.4.260.0160.05418.03
5.4.250.0060.06618.03
5.4.240.0210.05018.03
5.4.230.0160.05418.02
5.4.220.0160.05418.02
5.4.210.0130.05818.02
5.4.200.0150.05618.02
5.4.190.0120.05818.02
5.4.180.0150.06418.02
5.4.170.0140.05618.03
5.4.160.0170.05718.02
5.4.150.0170.05418.02
5.4.140.0170.05317.70
5.4.130.0120.05617.70
5.4.120.0140.05417.65
5.4.110.0160.05717.65
5.4.100.0140.05717.65
5.4.90.0090.06217.65
5.4.80.0100.06117.65
5.4.70.0130.05617.64
5.4.60.0180.05117.64
5.4.50.0150.05517.64
5.4.40.0140.05517.63
5.4.30.0150.06017.63
5.4.20.0180.06017.63
5.4.10.0240.06017.63
5.4.00.0130.05817.12
5.3.290.0220.07318.36
5.3.280.0130.06018.29
5.3.270.0170.05818.30
5.3.260.0130.06418.29
5.3.250.0180.05718.29
5.3.240.0110.06218.30
5.3.230.0190.05618.29
5.3.220.0120.06418.26
5.3.210.0110.06718.25
5.3.200.0150.07518.25
5.3.190.0120.06818.25
5.3.180.0210.05418.25
5.3.170.0260.06818.25
5.3.160.0150.05918.25
5.3.150.0180.05718.25
5.3.140.0180.06118.24
5.3.130.0210.06118.23
5.3.120.0180.06918.23
5.3.110.0170.08318.24
5.3.100.0180.06217.73
5.3.90.0150.06917.71
5.3.80.0100.06417.70
5.3.70.0210.06117.70
5.3.60.0200.05717.69
5.3.50.0170.05717.63
5.3.40.0180.05917.63
5.3.30.0130.06117.59
5.3.20.0220.05117.37
5.3.10.0220.05117.33
5.3.00.0140.06017.32
5.2.170.0150.05214.30
5.2.160.0180.05314.30
5.2.150.0160.05614.30
5.2.140.0160.06014.29
5.2.130.0150.05514.26
5.2.120.0140.05414.25
5.2.110.0180.05814.25
5.2.100.0130.05714.25
5.2.90.0300.07714.25
5.2.80.0230.07514.25
5.2.70.0130.05914.25
5.2.60.0140.06014.21
5.2.50.0200.05514.17
5.2.40.0160.05614.15
5.2.30.0140.05714.13
5.2.20.0140.07914.11
5.2.10.0280.06614.04
5.2.00.0130.05713.89
5.1.60.0140.05315.04
5.1.50.0180.04815.03
5.1.40.0140.05115.22
5.1.30.0130.05415.36
5.1.20.0160.06415.38
5.1.10.0230.06715.11
5.1.00.0160.06515.11
5.0.50.0140.07913.60
5.0.40.0190.05513.45
5.0.30.0160.07513.27
5.0.20.0110.06513.20
5.0.10.0130.06413.21
5.0.00.0090.08613.21
4.4.90.0130.08611.64
4.4.80.0170.08411.63
4.4.70.0110.09111.63
4.4.60.0160.10911.63
4.4.50.0180.08511.64
4.4.40.0040.10111.63
4.4.30.0110.08711.63
4.4.20.0140.08811.69
4.4.10.0100.09911.70
4.4.00.0160.09511.66
4.3.110.0140.09011.56
4.3.100.0190.08211.55
4.3.90.0190.11411.58
4.3.80.0180.12811.58
4.3.70.0210.13811.57
4.3.60.0160.12211.57
4.3.50.0230.11611.58
4.3.40.0150.13111.53
4.3.30.0130.13510.34
4.3.20.0130.14610.32
4.3.10.0150.12110.27
4.3.00.0070.12721.12

preferences:
29.28 ms | 400 KiB | 5 Q