3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()()))()(((()(()))))(())()()))(((()())))))))))(((())))()))())()))))()()(((())))))))()(()()(()))((()))))((())))((()((())))())))()()(()))())()(()((()())(()(()()())())(()()))()))))(()())()()))()()()()))(()(()(()))))))()(()))()))()()(()((())(()(())))()(((())(())())))))()(()(()))))()))(()()()(())()(()(())))()))))()()(((((())))))())()())())())()())()))))()))))))))())()()()()()()())))()))((())()))())))()((())()))))()))())))))))())()()()))()()(()((((()(((((((()(())((()())((()()))()))))(())))()()()(())((())()())))(())))(())))(((()()))()(())(((()(()))((())))())()))((((()))())()))))))))()(())())))(()))()(()()))())()()(())())))())()()(()())))()((()())(()(())(())))))))))))))(()))))()))))))()()())(()(((((()(()())))())()))(()))()))(()()))()())(()))())()(())((()()))))))())))())()(((())))(()(()))()()))()(()))))))((()())(()))))))()())))()()))))))))((((((((()()()(()))))))()())))())))()()((())()))((())(())))())())))()()()((()((()(())))())()(())))))))))()())))()()()()()()))()))((())())(()(()))))))(()()))()))(())))()))))))))))))(()))))))))()))))()))()())()))()()))))))()))))((()))))(()))())()(())))(()())((((()())))()))))(()))()(()()(())))))())))))()))))))())))())))))())))())())))())(()))))(())()(())))())()))((()()))))))())))((())))))))())))(())))))()()())))))())))))()))))))()))()()()(()(((()())())())(()))())))))((()(())(()))))))))(())))()()()())())(()))))()()()))()))())())())()(())))()(((()((((())))))))()))))))))))))))))))))((())()())(()))))()()))))))(()()(())())))())))((())))((())))))))))))))()))))()(()))))))())))))()))(()()())(()())))))))))()))))))(())))))()()))()())(((())))()))(()))))))))(())())))())))())())())()()))((())()(())()())()))()())(())(()))))()())))(()(((()))))))()(()())()()()))()))))))))()()()(())()())()(((((()))()())())(()))))()()()(())))())))()((()())))(()))())()(()())())(()))()()))((()()))((()()()()())))(())()))(()(())))((()()))))))))())))))))())()()))))))))))))))))(())()(())(())()())())()))()(()))))())())))))()())()(()))()()(())))(())())))))(()))))))))))))))())())(())(())))(((()))()))))())((())(()))())))))))())))))())))()))()))))))))))))())()))))()))))((()))(())))()(())))(())()))()))())))())))))))()(()())())))()()())))(())))))(()))))))))))))(()))()))()))())))(((()()()(())((()())))()())(((()))(())()))((()()()())))())(())(()))))()(((((())))(()))())())))))))((((()()()))())())()(()(()())))))))))()())())))(())))()())(((()(())())()()))())())))))))((()())((()()(()))(()(())))()))()))(()))(()))()()(()(((())((((()))()(()))((())()(()(()())()(()))()())))))(()))()))())()())))())))(())))((())(()())))))()))(())(()))()())()(()()((()(()))))))()(())(()())(())()))(((())()))(()()(()()()))))(()(())))()))))())))))())(()()()()()()(((())))(()()))()((())(((((()()())))(()))(()))()()))(((())())()(((()()()()))))(()))(())())))()())(()()())())))))))()))))((())))()())(()))(()(()))())))))())(())))))()()())())()))()()(())))(()))(())((((((())(()))(()))())()))(()()(())))()))(()()))()))()(())))(())))((()(()))(())()()())())))(((()()())(())()))))))()(((()(((((()()(((())(())))())()((()))))((()())()(())(((())))(((()((()(()(()))(()()))())(()))(())(())))()))))))((((()))()((((()(()))()))()()))))()(()(()))()(()((()(((()(()()(((()))))()(((()(()(()(((()(()())())()()(()(()())())(()((((())(()))()))(((((()()())(())()((()()())))()()(((()()))()((((((((()(())))())((()))))(())))(()))))((()((((()()(())(((((()))(((((((((((((()())))((((()(((()((())())()))((()))()(()()((()()()()(()()(()(()(((())()(()((((((()((()()((())()((((()((()()(()()())((()()()((()((())()(()(((()((())((((())(()))((()(()))(()())()((((((((()(((((((((((()))(()(((()(()()()((((())((())()())()))(())((())(()))(((()((()(())))(()))))((()()))))((((()(()(()())(()(())((((((((()((((()((()(((((()))())()(()))(()()((()(())(((((()(())()(((((()()))))))()(((())()(()()((((())()((())((()(((())(((()))((()()((((()(())))))((()((((()((()((()(((())((()))(((((((()(((()((((((((())()))((((())(((((()((((((((()(((()((()(((()()(((()((((((()()(()((((((((()()(()(()(())((((()())()))))(((()))((((())((((()())((()(())()((()((((((()((((((()(())))()())(((())())())()(())()(()())((()()((((())((((((())(()(((((()((((())()((((()(()(())(()())(((())()((())((((()))()((((((())(()(((()(((()((((((()(((()))(()()())())((()((()())()((((())(((()(()(((((((((())(())))()((()()()()(())((()))(((((((()(((((((((()(()))))(()((((((((()((((()((()()((((((()()(((((((()(()(())()(())((()()()((()(((((()())()(((((()())()()((()(()())(()()()(((()()(((((()((((((()()((()(()()()((((((((((((()((((((((()()(((()())))()(((()()(())())((((()((((()((((()()()(())(())((()(()(((((((((((((((()(())(())))))()()))((()(((()(())((()(((()(()()((((()()(((()(((()(((((()()((()(()(((()))((((((()((((((((()((()((())(((((()(((())(())())((()()))((((())()()((()(((()(((((()()(((()))(((()(()(((((((((((((()))((((((((()(((()))))())((((((((((((())((())((()())(((())((())(()((((((((((()(((())((()()(()((())(((((((((((()))((((((((((((()(()())((()((()((()(()(((()((((((((()()(()((()(()(((()))((()))(((((((((((((()(())((((((())(((()(())(()(()(()((()()))((((()((((()((((())))())((((()((((()))((((((()((((((()((()(((())))((())(()))(()((()((((()((()(((()()))((((()()()(((((((())(((())(()))())((((()())(((()(((((((((((()(()(()((()(((((((((((((((()()((((()((((((((()(((()()((()((((()))(((()(())((((((()((((())()((((()((()))(())()(()(((()((())())((((((()(()(())())(((())(()(()())(((((()((()((())()())(())))(((()(())))))))(((()(((()))()((()(((()()((()())()()))())))(((()))(()(((()(((((((((()(()(((((()()(((()())()()))))()(((()))(((()(()(()(()(()))()(())()))(()(((())))(()))))))))))(())((()((())((()(())()(())((()()((((()()((()()))((())(((()((()(())(())))()(()(((((()((()))())()(((((()()(((()(()((((((())(()))(())()))((()(()()))(())())()))(((())))(()((()(((())(())())))((()()((((((((((((((()((()(()()(()(((()))())()()((()()()(())(()))(()())(((())((())()(())()()(()()(())))((()(((()))))(((()()(()()))())((()((())()))((((()()()())((())))(((()(())(((((()(((((()((()(()((((()()(((()()()(((()())(((()()((((())(()))(((()))(())())((()))(((()((()))(((()()((())((()(((((()((((()()())((()))()((((()((()(()()()('; // Part one //$up = substr_count($input, '('); //$down = substr_count($input, ')'); //$floor = $up - $down; //echo $floor; // Part two $input = ')'; $length = strlen($input); $floor = 0; $pos = 0; while ($floor >= 0) { $char = $input[$pos]; $floor += ($char == '(') ? 1 : -1; } echo $char + 1;

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.0070.01116.63
8.3.50.0210.00821.29
8.3.40.0110.00718.84
8.3.30.0070.01018.97
8.3.20.0040.00422.04
8.3.10.0080.00023.53
8.3.00.0070.00023.53
8.2.180.0070.00716.50
8.2.170.0140.00322.96
8.2.160.0000.01420.52
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00019.27
8.2.120.0090.00026.35
8.2.110.0060.00320.53
8.2.100.0070.00717.72
8.2.90.0000.00817.91
8.2.80.0000.00819.39
8.2.70.0050.00317.80
8.2.60.0070.00017.80
8.2.50.0040.00418.10
8.2.40.0040.00420.65
8.2.30.0070.00320.58
8.2.20.0000.00817.84
8.2.10.0040.00418.13
8.2.00.0020.00518.08
8.1.280.0090.00925.92
8.1.270.0070.00721.98
8.1.260.0040.00428.09
8.1.250.0050.00328.09
8.1.240.0090.00020.70
8.1.230.0070.00420.89
8.1.220.0040.00417.79
8.1.210.0050.00518.77
8.1.200.0100.00017.23
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0040.00418.66
8.1.160.0030.00322.22
8.1.150.0000.00718.99
8.1.140.0000.00819.59
8.1.130.0030.00317.63
8.1.120.0000.00817.39
8.1.110.0000.00717.37
8.1.100.0040.00417.48
8.1.90.0040.00417.43
8.1.80.0000.01017.50
8.1.70.0000.00717.37
8.1.60.0040.00417.49
8.1.50.0000.00817.57
8.1.40.0040.00417.52
8.1.30.0000.00917.55
8.1.20.0000.00817.62
8.1.10.0030.00517.66
8.1.00.0050.00217.53
8.0.300.0040.00422.03
8.0.290.0000.00716.75
8.0.280.0040.00318.47
8.0.270.0000.00717.25
8.0.260.0060.00017.24
8.0.250.0000.00716.89
8.0.240.0060.00317.00
8.0.230.0070.00016.91
8.0.220.0050.00216.93
8.0.210.0050.00216.80
8.0.200.0040.00416.84
8.0.190.0000.00816.95
8.0.180.0000.00716.94
8.0.170.0000.00716.83
8.0.160.0040.00416.82
8.0.150.0080.00016.82
8.0.140.0040.00416.91
8.0.130.0070.00013.33
8.0.120.0000.00816.90
8.0.110.0080.00016.98
8.0.100.0040.00416.71
8.0.90.0000.00716.95
8.0.80.0030.01816.95
8.0.70.0030.00616.93
8.0.60.0050.00316.79
8.0.50.0000.00716.96
8.0.30.0080.01217.14
8.0.20.0070.01417.40
8.0.10.0000.00817.16
8.0.00.0110.00716.76
7.4.330.0000.00516.77
7.4.320.0000.00616.54
7.4.300.0030.00316.59
7.4.290.0000.00716.48
7.4.280.0030.00616.41
7.4.270.0030.00316.60
7.4.260.0070.00016.48
7.4.250.0000.00716.59
7.4.240.0040.00316.57
7.4.230.0030.00316.46
7.4.220.0060.00916.72
7.4.210.0130.00616.63
7.4.200.0070.00016.71
7.4.160.0120.00616.38
7.4.150.0100.00717.40
7.4.140.0080.01117.86
7.4.130.0050.01216.47
7.4.120.0100.00716.64
7.4.110.0060.01216.71
7.4.100.0130.01016.52
7.4.90.0060.00916.50
7.4.80.0080.00819.39
7.4.70.0060.01016.59
7.4.60.0070.01016.60
7.4.50.0090.00616.29
7.4.40.0030.01316.66
7.4.30.0110.00716.64
7.4.00.0060.00914.87
7.3.330.0000.00513.21
7.3.320.0000.00613.16
7.3.310.0050.00216.40
7.3.300.0030.00316.33
7.3.290.0070.01016.41
7.3.280.0080.00816.38
7.3.270.0090.00617.40
7.3.260.0030.01316.35
7.3.250.0140.00616.48
7.3.240.0120.00516.39
7.3.230.0100.01316.60
7.3.210.0000.01816.42
7.3.200.0100.01016.65
7.3.190.0060.01216.59
7.3.180.0090.00916.43
7.3.170.0040.01216.65
7.3.160.0080.00816.65
7.3.10.0090.00016.93
7.3.00.0070.00716.81
7.2.330.0120.00616.34
7.2.320.0100.00616.79
7.2.310.0060.01216.41
7.2.300.0060.01116.29
7.2.290.0100.00616.61
7.2.130.0110.00416.95
7.2.120.0050.01116.64
7.2.110.0100.01016.95
7.2.100.0070.01116.86
7.2.90.0110.01116.70
7.2.80.0030.01016.78
7.2.70.0090.00616.97
7.2.60.0070.00416.98
7.2.50.0160.00317.00
7.2.40.0060.00316.80
7.2.30.0080.00417.07
7.2.20.0060.01316.96
7.2.10.0030.01416.74
7.2.00.0060.00717.99
7.1.250.0110.00315.64
7.1.200.0060.00615.71
7.1.100.0030.00918.02
7.1.70.0000.00817.23
7.1.60.0150.00919.52
7.1.50.0000.01016.88
7.1.00.0030.06022.51
7.0.200.0030.00716.83
7.0.60.0070.04020.03
7.0.50.0030.04017.85
7.0.40.0000.05320.40
7.0.30.0370.07320.13
7.0.20.0170.05320.13
7.0.10.0070.08320.13
7.0.00.0100.03720.32
5.6.280.0000.07321.09
5.6.210.0070.05020.51
5.6.200.0070.08318.16
5.6.190.0130.08020.61
5.6.180.0270.08020.39
5.6.170.0270.05020.51
5.6.160.0030.08720.38
5.6.150.0070.07018.18
5.6.140.0030.05018.16
5.6.130.0070.08718.08
5.6.120.0030.08721.00
5.6.110.0070.08320.96
5.6.100.0130.07321.12
5.6.90.0170.05720.98
5.6.80.0200.06020.37
5.5.350.0270.08320.39
5.5.340.0100.07717.93
5.5.330.0070.05720.45
5.5.320.0200.04320.13
5.5.310.0270.03720.34
5.5.300.0070.03717.91
5.5.290.0270.06718.01
5.5.280.0100.07720.88
5.5.270.0030.08320.78
5.5.260.0100.08720.77
5.5.250.0200.08020.69
5.5.240.0200.04020.13

preferences:
57.39 ms | 401 KiB | 5 Q