3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "foo { bar tree; bar ball/sand; snafu { string; } random { nested { value; bohica; } nested again { foo; bar; } } }"; $buf = ""; $brace_level = 0; $words = array(); for ($i = 0; $i < strlen($text); $i++) { switch ($text[$i]) { case '{': $words[$brace_level] = trim($buf); $buf = ""; $brace_level++; break; case '}': $brace_level--; unset($words[$brace_level]); break; case ';': $words[$brace_level] = trim($buf); $buf = ""; ksort($words); print implode(" ", $words)."\n"; break; default: $buf .= $text[$i]; } }

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)
8.3.60.0190.00318.21
8.3.50.0140.00522.11
8.3.40.0070.01018.96
8.3.30.0080.00618.81
8.3.20.0160.00318.58
8.3.10.0040.00421.23
8.3.00.0000.00723.51
8.2.180.0120.00916.38
8.2.170.0110.00422.96
8.2.160.0100.00320.43
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0070.00726.16
8.2.120.0040.00419.48
8.2.110.0100.00020.95
8.2.100.0060.01117.97
8.2.90.0030.00519.26
8.2.80.0030.00617.97
8.2.70.0000.00817.75
8.2.60.0090.00017.93
8.2.50.0040.00418.10
8.2.40.0030.00618.16
8.2.30.0040.00419.91
8.2.20.0040.00417.71
8.2.10.0000.00717.72
8.2.00.0080.00017.71
8.1.280.0100.00725.92
8.1.270.0140.00023.99
8.1.260.0140.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00623.96
8.1.230.0080.00317.45
8.1.220.0000.00817.79
8.1.210.0030.00718.77
8.1.200.0030.00617.25
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0020.00519.01
8.1.150.0080.00018.63
8.1.140.0040.00417.43
8.1.130.0050.00317.38
8.1.120.0000.00717.47
8.1.110.0000.01017.36
8.1.100.0000.00817.35
8.1.90.0000.00717.41
8.1.80.0000.00717.48
8.1.70.0030.00317.44
8.1.60.0040.00417.49
8.1.50.0050.00317.47
8.1.40.0000.00817.52
8.1.30.0050.00317.56
8.1.20.0040.00417.52
8.1.10.0000.00717.46
8.1.00.0000.00717.48
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0000.00718.43
8.0.270.0030.00517.14
8.0.260.0070.00016.82
8.0.250.0020.00516.96
8.0.240.0050.00516.98
8.0.230.0000.00616.88
8.0.220.0070.00016.80
8.0.210.0000.00616.88
8.0.200.0030.00316.92
8.0.190.0000.00716.99
8.0.180.0070.00316.93
8.0.170.0040.00416.79
8.0.160.0050.00217.00
8.0.150.0040.00416.94
8.0.140.0100.00016.89
8.0.130.0000.00513.36
8.0.120.0040.00416.88
8.0.110.0040.00416.90
8.0.100.0000.00716.89
8.0.90.0040.00416.88
8.0.80.0100.01016.92
8.0.70.0060.00316.86
8.0.60.0030.00516.63
8.0.50.0000.00716.87
8.0.30.0130.00817.05
8.0.20.0120.00917.40
8.0.10.0040.00416.84
8.0.00.0170.00616.73
7.4.330.0050.00014.81
7.4.320.0070.00016.56
7.4.300.0030.00316.48
7.4.290.0070.00016.52
7.4.280.0040.00816.52
7.4.270.0000.00716.55
7.4.260.0030.00313.38
7.4.250.0040.00416.36
7.4.240.0000.00716.53
7.4.230.0030.00516.48
7.4.220.0120.00616.48
7.4.210.0060.01016.57
7.4.200.0040.00416.60
7.4.190.0050.00316.73
7.4.160.0100.01016.45
7.4.150.0040.01417.40
7.4.140.0050.01517.86
7.4.130.0080.01316.51
7.4.120.0130.00616.57
7.4.110.0100.00716.68
7.4.100.0070.01016.41
7.4.90.0130.01016.31
7.4.80.0030.01319.37
7.4.70.0130.00516.39
7.4.60.0040.01416.46
7.4.50.0040.00416.64
7.4.40.0040.01122.27
7.4.30.0070.01116.24
7.4.00.0110.00614.86
7.3.330.0030.00313.25
7.3.320.0030.00313.23
7.3.310.0030.00316.43
7.3.300.0000.00716.32
7.3.290.0000.01816.39
7.3.280.0080.01016.32
7.3.270.0170.00017.40
7.3.260.0100.01018.24
7.3.250.0090.01016.50
7.3.240.0150.00416.34
7.3.230.0100.00716.57
7.3.210.0090.00916.44
7.3.200.0000.01619.39
7.3.190.0050.01116.38
7.3.180.0060.01716.28
7.3.170.0000.01616.42
7.3.160.0100.00716.59
7.3.120.0090.00715.05
7.3.110.0070.01014.95
7.3.100.0000.01314.80
7.3.90.0060.00614.83
7.3.80.0070.00714.58
7.3.70.0000.01114.83
7.3.60.0080.00014.92
7.3.50.0040.00815.00
7.3.40.0140.00314.92
7.3.30.0100.00314.79
7.3.20.0000.01616.89
7.3.10.0060.00316.33
7.3.00.0120.00016.58
7.2.330.0150.00316.64
7.2.320.0120.01216.51
7.2.310.0140.00316.85
7.2.300.0040.01416.66
7.2.290.0080.00816.73
7.2.250.0090.01015.30
7.2.240.0030.01415.23
7.2.230.0060.00315.35
7.2.220.0080.00415.21
7.2.210.0030.00615.27
7.2.200.0060.00615.32
7.2.190.0030.01015.29
7.2.180.0000.01415.00
7.2.170.0040.01115.10
7.2.00.0000.01219.62
7.1.330.0070.00716.00
7.1.320.0030.00515.57
7.1.310.0100.00315.78
7.1.300.0030.01015.91
7.1.290.0070.00615.66
7.1.280.0060.00615.66
7.1.270.0000.01515.88
7.1.260.0110.00416.00
7.1.200.0060.00315.52
7.1.100.0000.01118.29
7.1.70.0040.00717.00
7.1.60.0090.01619.40
7.1.50.0060.01516.70
7.1.00.0070.05722.36
7.0.200.0030.00616.72
7.0.140.0000.07722.00
7.0.60.0030.08021.72
7.0.50.0100.07722.05
7.0.40.0070.08020.04
7.0.30.0070.06020.19
7.0.20.0030.08720.11
7.0.10.0000.07720.03
7.0.00.0070.04020.17
5.6.280.0070.07021.12
5.6.210.0000.08720.64
5.6.200.0100.07321.02
5.6.190.0030.08720.90
5.6.180.0070.07721.12
5.6.170.0130.08021.12
5.6.160.0030.08721.11
5.6.150.0100.07021.00
5.6.140.0030.08321.01
5.6.130.0130.07321.04
5.6.120.0030.05721.01
5.6.110.0070.07320.97
5.6.100.0030.08021.00
5.6.90.0000.06020.96
5.6.80.0130.07020.40
5.6.70.0100.07020.43
5.6.60.0030.04720.41
5.6.50.0070.05320.50
5.6.40.0000.08320.25
5.6.30.0030.07020.41
5.6.20.0030.08020.40
5.6.10.0030.08020.48
5.6.00.0030.06720.43
5.5.350.0100.08020.42
5.5.340.0030.08020.77
5.5.330.0070.08020.76
5.5.320.0070.06720.85
5.5.310.0170.06320.77
5.5.300.0030.07720.77
5.5.290.0130.07020.87
5.5.280.0030.05320.80
5.5.270.0030.08720.76
5.5.260.0000.05020.84
5.5.250.0100.07320.49
5.5.240.0030.08020.32
5.5.230.0030.07720.15
5.5.220.0000.08320.05
5.5.210.0070.07720.18
5.5.200.0000.05320.12
5.5.190.0030.07720.14
5.5.180.0000.07320.15
5.5.160.0070.07720.22
5.5.150.0030.07320.22
5.5.140.0000.08020.14
5.5.130.0100.07020.22
5.5.120.0100.05320.32
5.5.110.0100.07720.03
5.5.100.0070.07320.01
5.5.90.0000.06719.85
5.5.80.0030.05320.05
5.5.70.0130.07319.96
5.5.60.0070.08019.99
5.5.50.0100.07020.10
5.5.40.0030.08019.99
5.5.30.0100.07319.98
5.5.20.0070.07020.20
5.5.10.0070.07320.00
5.5.00.0000.07720.00
5.4.450.0130.07319.51
5.4.440.0030.06319.29
5.4.430.0030.06019.23
5.4.420.0070.06319.33
5.4.410.0100.07319.14
5.4.400.0070.06719.10
5.4.390.0100.07019.01
5.4.380.0030.06319.16
5.4.370.0000.07318.85
5.4.360.0000.05318.90
5.4.350.0000.08019.10
5.4.340.0070.07318.93
5.4.320.0100.05719.08
5.4.310.0030.06718.85
5.4.300.0030.07719.00
5.4.290.0030.07318.90
5.4.280.0070.07019.05
5.4.270.0030.07719.00
5.4.260.0100.07018.92
5.4.250.0070.07318.89
5.4.240.0070.06318.92
5.4.230.0000.08318.94
5.4.220.0100.07319.04
5.4.210.0030.05019.05
5.4.200.0070.07719.00
5.4.190.0030.05719.09
5.4.180.0000.07318.99
5.4.170.0070.07018.96
5.4.160.0100.06719.13
5.4.150.0070.06019.05
5.4.140.0070.05716.20
5.4.130.0000.07316.29
5.4.120.0000.06716.30
5.4.110.0000.05716.25
5.4.100.0170.06316.25
5.4.90.0070.06316.25
5.4.80.0030.07316.23
5.4.70.0030.07316.20
5.4.60.0100.07016.14
5.4.50.0030.06016.16
5.4.40.0100.06016.37
5.4.30.0070.05316.19
5.4.20.0030.06316.37
5.4.10.0070.05716.29
5.4.00.0070.07015.56
5.3.290.0070.07314.64
5.3.280.0030.07014.38
5.3.270.0100.07314.50
5.3.260.0030.07714.41
5.3.250.0070.07014.57
5.3.240.0030.06714.53
5.3.230.0000.08014.58
5.3.220.0070.07314.54
5.3.210.0130.06714.49
5.3.200.0070.07014.52
5.3.190.0100.07014.48
5.3.180.0100.06314.48
5.3.170.0000.08014.54
5.3.160.0030.07714.49
5.3.150.0000.07714.51
5.3.140.0030.08014.50
5.3.130.0000.08014.54
5.3.120.0070.07014.52
5.3.110.0000.07714.47
5.3.100.0000.07713.88
5.3.90.0000.06013.98
5.3.80.0070.03713.95
5.3.70.0030.06313.98
5.3.60.0000.07013.95
5.3.50.0000.07313.89
5.3.40.0000.07713.89
5.3.30.0030.07013.84
5.3.20.0030.07013.48
5.3.10.0100.06013.60
5.3.00.0000.07313.62
5.2.170.0000.06311.16
5.2.160.0000.06011.07
5.2.150.0030.06311.12
5.2.140.0030.06310.97
5.2.130.0030.05310.93
5.2.120.0030.05711.02
5.2.110.0070.05010.89
5.2.100.0030.06310.94
5.2.90.0030.06011.02
5.2.80.0000.06311.04
5.2.70.0070.05710.93
5.2.60.0000.06311.03
5.2.50.0000.04710.79
5.2.40.0030.05710.98
5.2.30.0030.06010.89
5.2.20.0030.04010.93
5.2.10.0000.03010.86
5.2.00.0000.03010.74
5.1.60.0000.02310.37
5.1.50.0030.04010.37
5.1.40.0000.05010.37
5.1.30.0030.05010.37
5.1.20.0000.03710.37
5.1.10.0000.04010.37
5.1.00.0000.03710.37
5.0.50.0000.02710.37
5.0.40.0000.04010.37
5.0.30.0070.05010.37
5.0.20.0030.03310.37
5.0.10.0000.04010.37
5.0.00.0000.06710.37
4.4.90.0000.03010.37
4.4.80.0070.02710.37
4.4.70.0000.02010.37
4.4.60.0000.03310.37
4.4.50.0030.04010.37
4.4.40.0000.02310.37
4.4.30.0000.02310.37
4.4.20.0000.03010.37
4.4.10.0070.01710.37
4.4.00.0000.02710.37
4.3.110.0000.02710.37
4.3.100.0000.03310.37
4.3.90.0000.03310.37
4.3.80.0000.05310.37
4.3.70.0070.03010.37
4.3.60.0030.03010.37
4.3.50.0070.03010.37
4.3.40.0000.05310.37
4.3.30.0000.04010.37
4.3.20.0000.04010.37
4.3.10.0000.03710.37
4.3.00.0030.03710.37

preferences:
37.16 ms | 400 KiB | 5 Q