3v4l.org

run code in 300+ PHP versions simultaneously
<?php test('()'); test('())'); test('(())'); test('))(('); test(')('); test(')(('); test('((()('); test('((()()(())))'); test('((()()(()))'); test('foo((bar)is(((baz))and)quix)'); function test($str) { echo "$str is ".(is_balanced($str)?'balanced':'not balanced')."\n"; } function is_balanced($str) { $count = 0; for($i=0;$i<strlen($str);$i++) { switch($str[$i]) { case '(': $count++; break; case ')': $count--; if($count < 0) return false; // ignore everything else } } return $count == 0; }

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.0120.00316.38
8.3.50.0100.00722.86
8.3.40.0070.00718.70
8.3.30.0070.00718.85
8.3.20.0060.00320.34
8.3.10.0030.00623.53
8.3.00.0060.00319.26
8.2.180.0150.00318.38
8.2.170.0120.00422.96
8.2.160.0070.00720.55
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00721.05
8.2.110.0060.00319.17
8.2.100.0040.00717.84
8.2.90.0070.00020.55
8.2.80.0060.00319.76
8.2.70.0000.00817.79
8.2.60.0040.00417.93
8.2.50.0050.00318.16
8.2.40.0000.00820.34
8.2.30.0000.00719.32
8.2.20.0040.00417.63
8.2.10.0070.00018.12
8.2.00.0040.00417.57
8.1.280.0100.01025.92
8.1.270.0060.00323.91
8.1.260.0030.00626.35
8.1.250.0050.00328.09
8.1.240.0030.00723.90
8.1.230.0100.00322.62
8.1.220.0040.00417.74
8.1.210.0040.00419.11
8.1.200.0040.00417.47
8.1.190.0050.00317.25
8.1.180.0030.00618.10
8.1.170.0030.00618.58
8.1.160.0050.00321.88
8.1.150.0080.00018.84
8.1.140.0070.00017.46
8.1.130.0030.00317.83
8.1.120.0050.00317.44
8.1.110.0080.00017.46
8.1.100.0040.00417.51
8.1.90.0030.00317.53
8.1.80.0000.00717.45
8.1.70.0030.00317.45
8.1.60.0000.01117.62
8.1.50.0040.00417.59
8.1.40.0000.00717.51
8.1.30.0050.00317.56
8.1.20.0030.00617.73
8.1.10.0080.00017.64
8.1.00.0040.00417.38
8.0.300.0000.00819.90
8.0.290.0070.00316.75
8.0.280.0050.00318.39
8.0.270.0080.00017.22
8.0.260.0000.00617.27
8.0.250.0040.00416.97
8.0.240.0040.00417.00
8.0.230.0020.00516.95
8.0.220.0030.00316.80
8.0.210.0000.00816.91
8.0.200.0030.00316.94
8.0.190.0040.00416.97
8.0.180.0040.00416.93
8.0.170.0000.00916.88
8.0.160.0000.00716.96
8.0.150.0030.00316.93
8.0.140.0000.00816.92
8.0.130.0030.00313.34
8.0.120.0000.00816.77
8.0.110.0030.00516.89
8.0.100.0070.00016.77
8.0.90.0000.00716.86
8.0.80.0130.00316.86
8.0.70.0030.00616.74
8.0.60.0080.00016.93
8.0.50.0020.00516.77
8.0.30.0140.00617.30
8.0.20.0130.00917.40
8.0.10.0040.00417.13
8.0.00.0120.00716.64
7.4.330.0050.00015.09
7.4.320.0000.00616.66
7.4.300.0030.00316.50
7.4.290.0030.00316.52
7.4.280.0040.00416.55
7.4.270.0030.00316.53
7.4.260.0040.00416.63
7.4.250.0040.00416.34
7.4.240.0040.00316.47
7.4.230.0040.00416.36
7.4.220.0120.00616.51
7.4.210.0070.00716.61
7.4.200.0030.00316.50
7.4.160.0060.00916.51
7.4.150.0120.00617.40
7.4.140.0090.00917.86
7.4.130.0130.00516.51
7.4.120.0090.00816.49
7.4.110.0150.00616.54
7.4.100.0080.01116.61
7.4.90.0060.01616.65
7.4.80.0090.00919.39
7.4.70.0140.00316.57
7.4.60.0140.00316.48
7.4.50.0000.00816.62
7.4.40.0130.00316.28
7.4.30.0050.01016.33
7.4.00.0110.00414.83
7.3.330.0030.00313.39
7.3.320.0060.00013.36
7.3.310.0070.00016.42
7.3.300.0060.00016.43
7.3.290.0060.01316.32
7.3.280.0090.01016.41
7.3.270.0100.00717.40
7.3.260.0100.01416.45
7.3.250.0100.00916.41
7.3.240.0070.01016.43
7.3.230.0060.01216.55
7.3.210.0050.01116.40
7.3.200.0060.01119.39
7.3.190.0070.01316.75
7.3.180.0000.01416.60
7.3.170.0080.00816.46
7.3.160.0040.01216.60
7.2.330.0130.01016.57
7.2.320.0110.00616.77
7.2.310.0070.01116.73
7.2.300.0180.00716.86
7.2.290.0100.00616.68
7.2.60.0070.01017.07
7.2.00.0030.00719.29
7.1.200.0070.00715.64
7.1.100.0060.00618.07
7.1.70.0000.01117.20
7.1.60.0120.00919.46
7.1.50.0100.01416.96
7.1.00.0000.08022.44
7.0.200.0040.00416.78
7.0.140.0000.07322.09
7.0.60.0100.05019.94
7.0.50.0000.04317.96
7.0.40.0100.05320.27
7.0.30.0230.04320.07
7.0.20.0270.07320.07
7.0.10.0070.07020.23
7.0.00.0100.03720.29
5.6.280.0000.09321.08
5.6.210.0030.08720.65
5.6.200.0170.07018.15
5.6.190.0070.08320.47
5.6.180.0230.04720.57
5.6.170.0270.07020.54
5.6.160.0170.04020.55
5.6.150.0100.07018.18
5.6.140.0100.05718.14
5.6.130.0070.08018.25
5.6.120.0100.07021.13
5.6.110.0000.04721.07
5.6.100.0100.07721.03
5.6.90.0200.06721.11
5.6.80.0170.07320.52
5.6.70.4430.04320.25
5.5.350.0030.03720.36
5.5.340.0030.08017.96
5.5.330.0030.06320.43
5.5.320.0130.09020.31
5.5.310.0230.03720.29
5.5.300.0000.07018.08
5.5.290.0070.07718.02
5.5.280.0030.04020.86
5.5.270.0100.08020.96
5.5.260.0130.07320.90
5.5.250.0030.04320.60
5.5.240.0270.07020.13
5.4.450.0130.05019.29
5.4.440.0770.04719.28
5.4.430.0500.04719.52
5.4.420.0430.03719.57
5.4.410.0530.02719.18
5.4.400.0130.04718.95
5.4.390.0470.04019.23
5.4.380.0370.05318.80
5.4.370.0630.06318.71
5.4.360.0370.05318.66
5.4.350.0270.06318.85
5.4.340.0370.06018.57
5.4.320.0050.03812.50
5.4.310.0090.03812.50
5.4.300.0080.03612.51
5.4.290.0090.04712.50
5.4.280.0060.03812.40
5.4.270.0050.03912.40
5.4.260.0110.04112.41
5.4.250.0070.03712.40
5.4.240.0060.03712.41
5.4.230.0100.03512.39
5.4.220.0090.04212.39
5.4.210.0060.03712.40
5.4.200.0060.03812.40
5.4.190.0070.03512.39
5.4.180.0060.03712.39
5.4.170.0050.03712.40
5.4.160.0080.03612.39
5.4.150.0070.04312.39
5.4.140.0030.04112.08
5.4.130.0080.03412.06
5.4.120.0080.03612.02
5.4.110.0040.04912.02
5.4.100.0090.03812.02
5.4.90.0050.04212.02
5.4.80.0050.04012.02
5.4.70.0090.03312.02
5.4.60.0080.03312.02
5.4.50.0110.04612.01
5.4.40.0140.04312.00
5.4.30.0070.04512.00
5.4.20.0080.03412.00
5.4.10.0070.03512.00
5.4.00.0030.04011.49
5.3.290.0060.04212.80
5.3.280.0070.03912.71
5.3.270.0120.04912.73
5.3.260.0060.04512.72
5.3.250.0070.03812.72
5.3.240.0050.04112.71
5.3.230.0050.04112.71
5.3.220.0070.03712.68
5.3.210.0090.03712.68
5.3.200.0090.03512.68
5.3.190.0060.03812.68
5.3.180.0070.03612.67
5.3.170.0100.03312.67
5.3.160.0080.03512.68
5.3.150.0100.03412.68
5.3.140.0040.04012.66
5.3.130.0130.04812.66
5.3.120.0130.04112.66
5.3.110.0070.05412.65
5.3.100.0100.04812.12
5.3.90.0090.03812.11
5.3.80.0070.04312.10
5.3.70.0060.03712.10
5.3.60.0110.03112.08
5.3.50.0090.03412.03
5.3.40.0030.04512.03
5.3.30.0070.03511.99
5.3.20.0090.03311.77
5.3.10.0100.03211.73
5.3.00.0070.03811.73
5.2.170.0080.0349.23
5.2.160.0050.0419.23
5.2.150.0070.0349.23
5.2.140.0080.0339.22
5.2.130.0090.0289.18
5.2.120.0070.0369.18
5.2.110.0130.0339.19
5.2.100.0050.0319.18
5.2.90.0030.0319.18
5.2.80.0080.0299.18
5.2.70.0060.0309.18
5.2.60.0050.0329.13
5.2.50.0040.0329.11
5.2.40.0090.0269.08
5.2.30.0040.0319.05
5.2.20.0080.0259.05
5.2.10.0070.0288.95
5.2.00.0070.0338.82
5.1.60.0050.0248.10
5.1.50.0060.0238.09
5.1.40.0060.0238.07
5.1.30.0070.0248.42
5.1.20.0050.0278.44
5.1.10.0060.0268.17
5.1.00.0130.0318.17
5.0.50.0030.0266.64
5.0.40.0080.0166.51
5.0.30.0080.0376.32
5.0.20.0060.0236.29
5.0.10.0040.0216.27
5.0.00.0060.0286.27
4.4.90.0050.0154.78
4.4.80.0050.0144.75
4.4.70.0020.0174.76
4.4.60.0040.0144.75
4.4.50.0030.0194.77
4.4.40.0030.0264.71
4.4.30.0040.0154.76
4.4.20.0050.0214.85
4.4.10.0050.0214.85
4.4.00.0030.0324.75
4.3.110.0020.0164.67
4.3.100.0030.0154.67
4.3.90.0060.0124.64
4.3.80.0060.0214.58
4.3.70.0020.0154.63
4.3.60.0020.0164.63
4.3.50.0020.0174.63
4.3.40.0030.0254.54
4.3.30.0030.0213.32
4.3.20.0040.0153.30
4.3.10.0040.0153.26
4.3.00.0000.02018.56

preferences:
45.77 ms | 401 KiB | 5 Q