3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '()()(()()()(()()((()((()))((()((((()()((((()))()((((())(((((((()(((((((((()(((())(()()(()((()()(()(())(()((((()((()()()((((())((((((()(()(((()())(()((((()))())(())(()(()()))))))))((((((((((((()())()())())(())))(((()()()((((()(((()(()(()()(()(()()(()(((((((())(())(())())))((()())()((((()()((()))(((()()()())))(())))((((())(((()())(())(()))(()((((()())))())((()(())(((()((((()((()(())())))((()))()()(()(()))))((((((((()())((((()()((((()(()())(((((()(()())()))())(((()))()(()(()(()((((()(())(()))(((((()()(()()()(()(((())())(((()()(()()))(((()()(((())())(()(())())()()(())()()()((()(((()(())((()()((())()))((()()))((()()())((((()(()()(()(((()))()(()))))((()(((()()()))(()(((())()(()((()())(()(()()(()())(())()(((()(()())()((((()((()))))())()))((()()()()(())()())()()()((((()))))(()(((()()(((((((())()))()((((()((())()(()())(())()))(()(()())(((((((())))(((()))())))))()))())((())(()()((())()())()))))()((()()())(())((())((((()())())()()()(((()))())))()()))())(()()()(()((((((()()))())()))()(((()(((())((((()()()(()))())()()))))())()))())((())()())(((((())())((())())))(((())(((())(((((()(((((())(()(()())())(()(())(()))(()((((()))())()))))())))((()(()))))())))(((((())()))())()))))()))))(((()))()))))((()))((()((()(()(())()())))(()()()(())()))()((((())))))))(())(()((()()))(()))(()))(()((()))))))()()((((()()))()())()))))))()()()))(()((())(()))((()()()())()(((()((((())())))()((((()(()))))))())))()()())()))(()))))(()())()))))))((())))))))())()))()((())())))(()((()))()))(())))))(()))()())()()))((()(()))()()()()))))())()()))())(())()()))()))((()))))()()(()())))))()()()))((((()))()))))(()(())))(()())))((())())(()))()))))()())))()())()())))))))))()()))))())))((())((()))))())))(((()())))))))(()))()()))(()))()))))()())))))())((((()())))))))())))()()))))))))()))()))))()))))))(())))))))))())))))))))))))))())())((())))))))))()))((())))()))))))))())()(()))))))())))))()()()())()(()()()(()())(()))()()()(()())))())())))()))))())))))))()()()()())(())())()())()))))(()()()()()))))()))())())))((()())()())))()))()))))(()())))()))))))))(((()))()()))))))))))))))))))))(()))(()((()))())))())(()))(()(()(())))))()(()))()))()()))))))))))))()((()())(())())()(())))))())()())((()()))))(()()))))())()(())()))))))))))))))))))))()))(()(()())))))))()()((()))()))))))((())))()))))))))((()))())()()))())()()))((()))())))))))))))(()())()))(())((()(()()))(()())(())))()())(()(())()()))))()))()(()))))))(()))))))))))(()))())))))))))())))))())))(())))))()))))(())())))))))))()(()))))()())))())(()))()())))))))))))))())()()))))()))))))())))))()))))(())(()()()()((())()))())(()))((())()))())())(())(()()))))()))(())()()((())(())))(())))()))())))))))))()(((((())())))(())()))))(())))((()))()(((((((()))))()()))(())))))()(()))))(()()))()))())))))))(()())()))))))))())))(()))())()))(())()((())())()())())(()(()))))()))))))((()())(())()()(()())))()()))(())(())(()))())))()))(()))()()))((((()))))()))((()()()))))()))()))())))(()))()))))(())))()))())()(()))()())))())))))))())))())))()()))))))(()))())())))()))()()())())))))))))))))())))()))(()()))))())))())()(())))())))))))))))))))))()()())())))))()()()((()(()))()()(())()())()))()))))()()()))))))((()))))))))()(()(()((((((()()((()())))))))))))()))())))))((())())(()))())))())))))())()()())(())))())))()())())(())))))))()()(())))()))())))())())())()))))))))()))(()()()())())())))(())())))))))()()())()))))())))())()(())())))))))()())()))(()()(())())))()(()((()()((()()(((((())(()())()))(())()))(())))(())))))))()))()))((()))()))()))))))))()))))))))((()()())(()))(((()))(())))()))((())(((())))()())))())))))((())))))(())())((((((())())()(()))()(()((()())))((())()(()(()))))(())(()()())(())))())((()(((())())))(((()())())))())()(())())((((()()))))())((()))()()()()(())(((((((()()()((()))())(()())))(())())((((()()(()))))()((())))((())()))()(((()))())))()))((()(()))(())(()((((())((((()()(()()))(((())(()))))((((()(()))(())))))((()))(()))((()(((()(()))(()(()((()(())(()(()(()(()()((()))())(((())(()(()))))(()))()()))(())))(())()(((())(()))()((((()()))))())(()))))((())()((((()(((()))())())(((()))()())((())(())())(())()(())()(()()((((((()()))))()()(((()()))))()())()(((()(()))(()(()())(()(()))))(((((()(((())())))))(((((()((()()((())())((((((()(())(()()((()()()()()()()(()()))()(((()))()))(((((((())(((()((()())()((((())(((()(())))()((()(()()()((())((()())()))()))())))())((((((()))(()(()()()))(()((()(()(()))()((()(((()()()((())(((((())()(()))())())((()(())))(()(()())(())((())())())(((()()()(())))))())(()))))))()))))))())((()()()))((()((((((()))(((()((((()()()(((()))())()(()()(((()((()()()()())()()))()()()(()(())((()))))(()))())))))))()(()()(((((())()(()(((((()((()(()()())(()((((((((()((((((())()((((()()()((()((()((((((()))((())))))))())()))((()(()))()(()()(()((())((()()((((((((((((()())(()()()))((((()((((((())(()))())(()()((()()))()(((((((()((()()((((((()(((())))((())))((((((((()()(((((((())(((((()())(((())((())()((((()(((((((()(()(((()((((((()(((()(((((((((((()()((()()(()))((()()(((()(((())))((((())()(()(((())()(()(((())(((((((((((()))())))((((((())((()()((((()())())((((()()))((())(((((()(()()(()()()((())(()((()()((((()(((((()((()(()((((()())((((((()(((((()()(()(()((((())))(())(())(())((((()(()()((((()((((()()((()((((((())))(((((()))))()))(()((((((((()(((())())(((())))(()(()((())(((()((()()(((((()((()()(((())()(()))(((((((())(()(((((()))((()((()((()))(())())((((()((((())()(()))(((()(((((((((((((((())(((((((((()))(((()(()()()()((((((()((())()((((((((()(())(((((((((((()(()((())()((()()(()(()()((((()()((())(()((()()(()()((((()(((((((())))((((())(())()(((()()((()()((((()((()(((()((())(((()()()((((()((((()()(()(()((((((((())(()(((((())(()())(((((((()())()(()((((()((())(()()())((((()()(((()((((())(())(()()(((((((((()()))()(((())(()(()((((((())(()()())(()))()()(((()(((()((())(()(((((((()(()(()((()(((((()(()((()(()((((((()((((()()((((()(((()((())(()(()((()()((((()()(())()(())(((())(()((((((((()())(((((((((()(())()((((())))()))()()(((((()()((((((())(()()(((()(()(((((((()(()(((((((())(())((((()((()(())))((((()()())(()))((()())((((()(((((()(()(())(()(()()())(((((()(((((()((((()()((((((((()()))(()((((((())((((())()(()(((()()()(((()(()(())(())(((((()(())())((((())(())(()(((()(((((())((((())())((()(((((((()(((())(()(()))(((((((((()((()((()()(()((((())(((()((())((((())(()(((()(((()(()((((()(((())(()(((()(()()(()(()((()()(()())(())())((()(()(((()(((()(((()()(((((((((()(((((((((()()(((()(((()())((((()(()(((()()()((())((((((((((())(()(((()((((()())((((()((()))(((()()()(((((()(((((((())((()())(()((((())((((((((())(()((()((((((((((()()((()((()()))(((()())()())()(((()())()()(()(()(((((((())()))(())()))())()()((())()((()((((()((()((())(((((()((((((()(())))(()))())(((()))((()()(()(((()))((((())()(((()))))()(()(())()(((((())(()(()(())(())()((()()()((((()(())((()())(()(()))(()(()(()()(())()()(()((())()((()))))()))((()(()()()()((()())(()))())()(()(((((((((())())((()((()((((((())()((((())(((())((()(()()()((())(()((())(((()((((()()((()(()(((((())()))()((((((()))((())(((()()))(((())(())()))(((((((())(())())()(())(((((()))()((()))()(()()((()()()()()())((((((('; $cpt = 0; for ($i = 0; $i < count($string); $i++) { if ($string[$i] == '(') { $cpt++; } else if ($string[$cpt] == ')') { $cpt--; } } print $cpt;

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.0100.01016.63
8.3.50.0030.01518.04
8.3.40.0120.00318.79
8.3.30.0070.00718.89
8.3.20.0070.00020.16
8.3.10.0080.00023.52
8.3.00.0060.00319.79
8.2.180.0160.00618.66
8.2.170.0100.01022.96
8.2.160.0070.01020.25
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00620.97
8.2.120.0040.00426.35
8.2.110.0090.00020.64
8.2.100.0030.00917.93
8.2.90.0080.00019.04
8.2.80.0060.00317.97
8.2.70.0030.00617.62
8.2.60.0040.00717.65
8.2.50.0040.00418.07
8.2.40.0030.00620.43
8.2.30.0000.00820.53
8.2.20.0040.00417.65
8.2.10.0000.00718.20
8.2.00.0030.00618.14
8.1.280.0100.00325.92
8.1.270.0060.00320.37
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0040.00423.80
8.1.230.0070.00417.77
8.1.220.0000.00917.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0080.00018.46
8.1.160.0040.00420.74
8.1.150.0040.00418.82
8.1.140.0030.00619.52
8.1.130.0000.00717.77
8.1.120.0000.00817.47
8.1.110.0070.00017.43
8.1.100.0000.00717.45
8.1.90.0050.00317.48
8.1.80.0050.00217.44
8.1.70.0000.00717.48
8.1.60.0000.00817.61
8.1.50.0040.00417.55
8.1.40.0040.00417.56
8.1.30.0000.00817.64
8.1.20.0000.00817.65
8.1.10.0000.00817.62
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0060.00616.75
8.0.280.0040.00418.32
8.0.270.0070.00017.21
8.0.260.0060.00017.26
8.0.250.0040.00416.90
8.0.240.0000.00716.99
8.0.230.0030.00316.86
8.0.220.0080.00016.91
8.0.210.0030.00316.79
8.0.200.0040.00416.99
8.0.190.0000.00716.94
8.0.180.0030.00916.89
8.0.170.0020.00517.02
8.0.160.0030.00316.83
8.0.150.0040.00417.05
8.0.140.0070.00016.85
8.0.130.0000.00613.40
8.0.120.0070.00016.84
8.0.110.0040.00416.99
8.0.100.0040.00416.86
8.0.90.0000.00717.01
8.0.80.0030.01417.00
8.0.70.0000.00817.02
8.0.60.0040.00416.96
8.0.50.0060.00316.93
8.0.30.0090.01117.22
8.0.20.0080.01117.40
8.0.10.0040.00416.96
8.0.00.0110.00716.86
7.4.330.0050.00016.83
7.4.320.0040.00416.63
7.4.300.0000.00616.64
7.4.290.0000.00716.38
7.4.280.0040.00416.53
7.4.270.0070.00016.43
7.4.260.0030.00716.50
7.4.250.0040.00416.63
7.4.240.0020.00616.59
7.4.230.0000.00716.54
7.4.220.0100.01416.65
7.4.210.0070.00716.57
7.4.200.0030.00316.27
7.4.160.0090.00616.44
7.4.150.0130.00317.40
7.4.140.0110.01317.86
7.4.130.0090.00716.48
7.4.120.0080.01416.54
7.4.110.0130.01016.64
7.4.100.0070.01116.57
7.4.90.0120.00916.55
7.4.80.0160.00719.39
7.4.70.0170.00016.42
7.4.60.0090.01016.51
7.4.50.0000.01416.54
7.4.40.0080.00816.70
7.4.30.0080.01316.78
7.4.00.0070.00615.06
7.3.330.0030.00313.09
7.3.320.0000.00613.11
7.3.310.0070.00016.46
7.3.300.0030.00316.19
7.3.290.0050.01016.34
7.3.280.0080.00916.37
7.3.270.0100.01317.40
7.3.260.0060.01216.42
7.3.250.0170.00516.39
7.3.240.0090.00816.49
7.3.230.0040.01316.43
7.3.210.0160.00316.62
7.3.200.0100.00616.44
7.3.190.0110.00816.50
7.3.180.0070.01016.35
7.3.170.0120.00916.41
7.3.160.0130.00316.56
7.3.120.0100.00714.78
7.3.110.0040.01514.77
7.3.100.0100.01014.82
7.3.90.0060.00914.87
7.3.80.0060.00615.16
7.3.70.0130.00614.96
7.3.60.0040.01214.81
7.3.50.0070.00714.68
7.3.40.0030.00714.89
7.3.30.0090.00914.71
7.3.20.0040.01216.80
7.3.10.0040.01016.68
7.3.00.0040.01116.68
7.2.330.0120.00616.54
7.2.320.0110.00616.59
7.2.310.0100.01316.33
7.2.300.0120.01316.71
7.2.290.0030.01416.51
7.2.250.0130.00615.05
7.2.240.0110.00615.11
7.2.230.0040.01214.94
7.2.220.0040.00815.08
7.2.210.0040.01515.04
7.2.200.0030.00615.05
7.2.190.0030.01315.04
7.2.180.0040.01115.28
7.2.170.0100.00715.18
7.2.130.0050.00916.89
7.2.120.0050.00917.01
7.2.110.0030.01217.02
7.2.100.0090.00316.93
7.2.90.0090.00716.96
7.2.80.0050.01016.85
7.2.70.0080.00517.08
7.2.60.0090.00716.91
7.2.50.0060.00616.88
7.2.40.0030.01017.09
7.2.30.0050.00716.94
7.2.20.0050.01117.18
7.2.10.0050.00516.95
7.2.00.0080.00817.74
7.1.330.0100.00315.89
7.1.320.0030.01215.60
7.1.310.0070.01015.87
7.1.300.0100.00315.77
7.1.290.0070.00715.79
7.1.280.0060.00315.73
7.1.270.0060.01015.84
7.1.260.0000.01815.88
7.1.250.0060.00615.70
7.1.200.0040.00715.95
7.1.100.0000.00918.05
7.1.70.0040.00417.13
7.1.60.0130.01019.13
7.1.50.0000.02217.01
7.1.00.0000.08022.43
7.0.200.0030.00516.78
7.0.60.0070.09020.00
7.0.50.0170.05317.82
7.0.40.0070.08020.30
7.0.30.0170.04720.00
7.0.20.0400.06720.17
7.0.10.0100.07720.19
7.0.00.0030.07020.16
5.6.280.0030.06021.03
5.6.210.0100.08020.55
5.6.200.0070.08318.13
5.6.190.0030.05320.47
5.6.180.0400.06720.35
5.6.170.0270.06720.41
5.6.160.0130.03320.50
5.6.150.0100.06018.21
5.6.140.0000.07018.18
5.6.130.0100.03718.14
5.6.120.0200.07321.00
5.6.110.0130.07021.12
5.6.100.0070.08720.94
5.6.90.0070.04020.97
5.6.80.0230.06020.26
5.5.350.0170.08020.54
5.5.340.0200.07017.97
5.5.330.0130.07020.57
5.5.320.0200.08720.32
5.5.310.0230.04720.27
5.5.300.0170.05717.98
5.5.290.0130.04717.92
5.5.280.0100.08320.80
5.5.270.0030.04320.89
5.5.260.0030.05020.89
5.5.250.0100.05320.62
5.5.240.0130.04020.19

preferences:
69.85 ms | 400 KiB | 5 Q