3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_1($nb) { $t = microtime(true); $a = 'f'; $t = microtime(true); $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { if ($a==='a') { $b .= $a; } else if ($a==='b') { $b .= $a; } else if ($a==='c') { $b .= $a; } else if ($a==='d') { $b .= $a; } else if ($a==='e') { $b .= $a; } else if ($a==='f') { $b .= $a; } } return (microtime(true) - $t); } function test_2($nb) { $a = 'f'; $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { switch ($a) { case 'a': $b .= $a; case 'b': $b .= $a; case 'c': $b .= $a; case 'd': $b .= $a; case 'e': $b .= $a; case 'f': $b .= $a; } } return (microtime(true) - $t); } $nb = 1000; echo 'test_1: '.test_1($nb).'<br/>'; echo 'test_2: '.test_2($nb).'<br/>';

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.10.0030.01215.20
7.4.00.0110.00614.98
7.3.130.0060.00914.76
7.3.120.0110.01114.64
7.3.110.0100.00615.20
7.3.100.0080.00814.68
7.3.90.0030.00914.98
7.3.80.0030.01114.81
7.3.70.0060.00315.05
7.3.60.0100.00314.66
7.3.50.0040.00914.82
7.3.40.0040.00814.89
7.3.30.0000.01715.00
7.3.20.0030.01016.62
7.3.10.0070.01116.75
7.3.00.0070.00716.81
7.2.260.0000.01915.15
7.2.250.0070.01014.75
7.2.240.0070.00715.35
7.2.230.0070.00714.85
7.2.220.0100.00614.99
7.2.210.0040.01115.01
7.2.200.0070.00715.22
7.2.190.0030.01114.96
7.2.180.0030.01315.20
7.2.170.0070.00714.93
7.2.160.0000.01215.17
7.2.150.0030.01016.94
7.2.140.0000.01616.99
7.2.130.0100.00616.88
7.2.120.0060.00916.84
7.2.110.0060.00617.05
7.2.100.0030.01416.88
7.2.90.0130.00017.06
7.2.80.0060.00917.09
7.2.70.0080.00617.02
7.2.60.0060.00917.07
7.2.50.0070.01017.05
7.2.40.0060.00316.99
7.2.30.0040.01116.96
7.2.20.0040.01416.90
7.2.10.0090.00916.94
7.2.00.0070.00918.11
7.1.330.0140.00015.78
7.1.320.0000.01015.81
7.1.310.0110.00415.78
7.1.300.0070.01015.88
7.1.290.0090.00615.88
7.1.280.0030.00615.80
7.1.270.0000.01215.54
7.1.260.0000.01115.63
7.1.250.0060.00915.65
7.1.240.0120.00315.94
7.1.230.0090.00615.93
7.1.220.0030.00915.86
7.1.210.0070.00715.93
7.1.200.0040.01215.82
7.1.190.0030.01015.80
7.1.180.0130.00316.01
7.1.170.0070.00415.86
7.1.160.0120.00415.86
7.1.150.0090.00315.97
7.1.140.0030.01015.88
7.1.130.0070.00315.57
7.1.120.0000.01515.79
7.1.110.0100.00315.79
7.1.100.0040.01115.89
7.1.90.0050.00515.98
7.1.80.0150.00015.82
7.1.70.0030.00916.50
7.1.60.0050.01517.61
7.1.50.0050.00816.42
7.1.40.0030.00916.01
7.1.30.0090.00015.71
7.1.20.0000.01315.66
7.1.10.0070.00715.61
7.1.00.0040.02119.21
7.0.330.0060.00915.12
7.0.320.0000.01615.50
7.0.310.0090.00615.44
7.0.300.0030.01315.51
7.0.290.0040.01115.57
7.0.280.0070.00715.25
7.0.270.0100.00615.44
7.0.260.0080.00415.17
7.0.250.0030.00615.66
7.0.240.0060.00615.60
7.0.230.0000.01515.59
7.0.220.0100.00315.45
7.0.210.0060.00615.47
7.0.200.0050.00416.20
7.0.190.0070.01015.52
7.0.180.0060.00615.46
7.0.170.0060.00915.55
7.0.160.0060.00915.36
7.0.150.0030.00615.52
7.0.140.0070.03718.62
7.0.130.0040.00815.54
7.0.120.0030.00615.56
7.0.110.0040.01115.50
7.0.100.0080.03417.78
7.0.90.0070.04517.74
7.0.80.0120.02917.59
7.0.70.0030.02517.75
7.0.60.0050.02417.60
7.0.50.0170.02717.94
7.0.40.0030.02616.73
7.0.30.0030.02916.63
7.0.20.0120.01816.68
7.0.10.0090.02016.83
7.0.00.0090.01816.75
5.6.400.0030.01014.70
5.6.390.0030.00714.79
5.6.380.0070.01114.66
5.6.370.0040.01114.19
5.6.360.0030.01014.08
5.6.350.0040.01114.59
5.6.340.0040.01114.38
5.6.330.0090.00614.21
5.6.320.0030.01014.57
5.6.310.0040.00814.30
5.6.300.0080.00614.63
5.6.290.0040.01114.29
5.6.280.0080.04017.80
5.6.270.0060.00614.45
5.6.260.0080.00814.68
5.6.250.0100.04017.45
5.6.240.0120.03817.50
5.6.230.0170.02217.46
5.6.220.0030.02617.40
5.6.210.0030.02617.36
5.6.200.0030.02217.69
5.6.190.0060.01817.71
5.6.180.0020.02817.59
5.6.170.0090.02717.60
5.6.160.0080.02217.88
5.6.150.0080.02517.84
5.6.140.0080.02517.70
5.6.130.0050.02417.55
5.6.120.0070.02517.73
5.6.110.0030.02817.74
5.6.100.0020.02617.77
5.6.90.0050.02217.65
5.6.80.0030.04717.37
5.6.70.0030.04517.35
5.6.60.0120.04017.42
5.6.50.0070.04417.41
5.6.40.0060.02517.38
5.6.30.0090.04017.39
5.6.20.0060.04517.40
5.6.10.0080.04017.21
5.6.00.0080.04017.33
5.5.380.0090.02717.17
5.5.370.0010.03417.29
5.5.360.0000.03017.31
5.5.350.0080.02517.38
5.5.340.0060.02317.61
5.5.330.0050.02417.52
5.5.320.0030.02617.44
5.5.310.0100.02717.56
5.5.300.0030.02317.60
5.5.290.0050.02717.50
5.5.280.0030.02517.71
5.5.270.0070.02317.53
5.5.260.0050.02517.56
5.5.250.0030.03017.49
5.5.240.0110.03817.20
5.5.230.0050.04517.28
5.5.220.0030.04317.32
5.5.210.0100.04317.40
5.5.200.0030.04017.32
5.5.190.0070.04517.32
5.5.180.0050.04417.33
5.5.170.0080.00414.46
5.5.160.0050.04717.15
5.5.150.0080.04317.32
5.5.140.0050.04717.33
5.5.130.0050.03017.39
5.5.120.0050.04517.29
5.5.110.0080.04217.10
5.5.100.0130.03317.16
5.5.90.0050.04317.09
5.5.80.0150.03717.21
5.5.70.0070.04317.04
5.5.60.0100.03316.96
5.5.50.0080.03017.20
5.5.40.0050.04017.21
5.5.30.0120.04017.03
5.5.20.0070.04117.19
5.5.10.0080.04017.26
5.5.00.0080.04117.00
5.4.450.0030.02515.22
5.4.440.0070.02315.31
5.4.430.0030.02315.18
5.4.420.0080.02015.25
5.4.410.0030.02715.17
5.4.400.0120.01814.99
5.4.390.0060.02615.00
5.4.380.0080.04215.00
5.4.370.0110.03915.16
5.4.360.0110.03514.95
5.4.350.0070.04215.12
5.4.340.0030.04514.99
5.4.330.0030.01011.39
5.4.320.0080.03915.02
5.4.310.0100.03815.21
5.4.300.0080.04215.06
5.4.290.0080.04014.98
5.4.280.0080.04015.11
5.4.270.0130.02315.09
5.4.260.0040.04115.02
5.4.250.0080.03715.12
5.4.240.0080.04114.97
5.4.230.0050.04215.02
5.4.220.0050.04214.95
5.4.210.0060.03014.94
5.4.200.0090.03915.10
5.4.190.0030.04015.18
5.4.180.0080.03814.95
5.4.170.0050.03415.10
5.4.160.0080.02214.92
5.4.150.0030.03315.16
5.4.140.0050.04313.91
5.4.130.0020.04313.78
5.4.120.0080.03213.82
5.4.110.0100.03513.69
5.4.100.0040.03913.86
5.4.90.0050.04113.85
5.4.80.0050.03513.72
5.4.70.0100.03513.76
5.4.60.0030.04013.78
5.4.50.0080.02313.74
5.4.40.0070.03713.87
5.4.30.0100.04513.63
5.4.20.0080.03613.65
5.4.10.0080.02313.63
5.4.00.0080.04013.40
5.3.290.0060.02212.74
5.3.280.0030.02712.72
5.3.270.0020.03012.74
5.3.260.0050.03912.70
5.3.250.0050.04312.68
5.3.240.0080.02212.70
5.3.230.0070.04012.69
5.3.220.0070.04012.64
5.3.210.0060.03812.71
5.3.200.0070.04212.71
5.3.190.0050.04312.73
5.3.180.0030.04612.71
5.3.170.0030.03012.65
5.3.160.0060.04012.72
5.3.150.0030.04512.64
5.3.140.0080.03912.71
5.3.130.0100.03312.70
5.3.120.0070.03912.72
5.3.110.0100.03612.71
5.3.100.0050.03612.38
5.3.90.0020.03912.43
5.3.80.0050.02512.36
5.3.70.0100.04012.43
5.3.60.0030.02412.36
5.3.50.0040.04012.39
5.3.40.0070.03712.36
5.3.30.0080.03512.36
5.3.20.0100.03912.30
5.3.10.0100.03312.16
5.3.00.0080.04112.22
5.2.170.0070.02711.23
5.2.160.0100.05311.24
5.2.150.0170.04711.14
5.2.140.0100.06011.05
5.2.130.0100.05711.00
5.2.120.0000.07011.09
5.2.110.0130.05011.17
5.2.100.0030.06711.16
5.2.90.0030.06311.16
5.2.80.0070.06311.22
5.2.70.0070.05011.24
5.2.60.0030.03711.18
5.2.50.0030.05711.04
5.2.40.0130.05311.06
5.2.30.0070.06311.06
5.2.20.0030.03010.88
5.2.10.0070.04310.89
5.2.00.0030.03710.66
5.1.60.0100.04310.04
5.1.50.0100.04310.11
5.1.40.0100.05010.07
5.1.30.0070.05010.38
5.1.20.0030.03710.47
5.1.10.0130.04310.07
5.1.00.0070.04010.14
5.0.50.0000.0278.56
5.0.40.0100.0308.44
5.0.30.0030.0378.30
5.0.20.0030.0338.31
5.0.10.0030.0508.04
5.0.00.0030.0538.18
4.4.90.0030.0237.55
4.4.80.0070.0337.55
4.4.70.0030.0207.55
4.4.60.0030.0307.55
4.4.50.0000.0307.55
4.4.40.0000.0507.55
4.4.30.0000.0337.55
4.4.20.0030.0377.55
4.4.10.0070.0277.55
4.4.00.0070.0437.55
4.3.110.0000.0277.55
4.3.100.0000.0337.55
4.3.90.0000.0237.55
4.3.80.0000.0577.55
4.3.70.0030.0177.55
4.3.60.0030.0377.55
4.3.50.0000.0337.55
4.3.40.0000.0307.55
4.3.30.0000.0407.55
4.3.20.0000.0407.55
4.3.10.0000.0207.55
4.3.00.0030.0377.55

preferences:
42.61 ms | 401 KiB | 5 Q