3v4l.org

run code in 300+ PHP versions simultaneously
<?php function floorDiff(string $input): int { $positiveMatches = preg_match_all ('/\(/', $input); $negativeMatches = preg_match_all ('/\)/', $input); return $positiveMatches - $negativeMatches; } assert(floorDiff('(') === 1); assert(floorDiff(')') === -1); assert(floorDiff('()') === 0); assert(floorDiff('(()))))') === -3); var_dump (floorDiff('()()(()()()(()()((()((()))((()((((()()((((()))()((((())(((((((()(((((((((()(((())(()()(()((()()(()(())(()((((()((()()()((((())((((((()(()(((()())(()((((()))())(())(()(()()))))))))((((((((((((()())()())())(())))(((()()()((((()(((()(()(()()(()(()()(()(((((((())(())(())())))((()())()((((()()((()))(((()()()())))(())))((((())(((()())(())(()))(()((((()())))())((()(())(((()((((()((()(())())))((()))()()(()(()))))((((((((()())((((()()((((()(()())(((((()(()())()))())(((()))()(()(()(()((((()(())(()))(((((()()(()()()(()(((())())(((()()(()()))(((()()(((())())(()(())())()()(())()()()((()(((()(())((()()((())()))((()()))((()()())((((()(()()(()(((()))()(()))))((()(((()()()))(()(((())()(()((()())(()(()()(()())(())()(((()(()())()((((()((()))))())()))((()()()()(())()())()()()((((()))))(()(((()()(((((((())()))()((((()((())()(()())(())()))(()(()())(((((((())))(((()))())))))()))())((())(()()((())()())()))))()((()()())(())((())((((()())())()()()(((()))())))()()))())(()()()(()((((((()()))())()))()(((()(((())((((()()()(()))())()()))))())()))())((())()())(((((())())((())())))(((())(((())(((((()(((((())(()(()())())(()(())(()))(()((((()))())()))))())))((()(()))))())))(((((())()))())()))))()))))(((()))()))))((()))((()((()(()(())()())))(()()()(())()))()((((())))))))(())(()((()()))(()))(()))(()((()))))))()()((((()()))()())()))))))()()()))(()((())(()))((()()()())()(((()((((())())))()((((()(()))))))())))()()())()))(()))))(()())()))))))((())))))))())()))()((())())))(()((()))()))(())))))(()))()())()()))((()(()))()()()()))))())()()))())(())()()))()))((()))))()()(()())))))()()()))((((()))()))))(()(())))(()())))((())())(()))()))))()())))()())()())))))))))()()))))())))((())((()))))())))(((()())))))))(()))()()))(()))()))))()())))))())((((()())))))))())))()()))))))))()))()))))()))))))(())))))))))())))))))))))))))())())((())))))))))()))((())))()))))))))())()(()))))))())))))()()()())()(()()()(()())(()))()()()(()())))())())))()))))())))))))()()()()())(())())()())()))))(()()()()()))))()))())())))((()())()())))()))()))))(()())))()))))))))(((()))()()))))))))))))))))))))(()))(()((()))())))())(()))(()(()(())))))()(()))()))()()))))))))))))()((()())(())())()(())))))())()())((()()))))(()()))))())()(())()))))))))))))))))))))()))(()(()())))))))()()((()))()))))))((())))()))))))))((()))())()()))())()()))((()))())))))))))))(()())()))(())((()(()()))(()())(())))()())(()(())()()))))()))()(()))))))(()))))))))))(()))())))))))))())))))())))(())))))()))))(())())))))))))()(()))))()())))())(()))()())))))))))))))())()()))))()))))))())))))()))))(())(()()()()((())()))())(()))((())()))())())(())(()()))))()))(())()()((())(())))(())))()))())))))))))()(((((())())))(())()))))(())))((()))()(((((((()))))()()))(())))))()(()))))(()()))()))())))))))(()())()))))))))())))(()))())()))(())()((())())()())())(()(()))))()))))))((()())(())()()(()())))()()))(())(())(()))())))()))(()))()()))((((()))))()))((()()()))))()))()))())))(()))()))))(())))()))())()(()))()())))())))))))())))())))()()))))))(()))())())))()))()()())())))))))))))))())))()))(()()))))())))())()(())))())))))))))))))))))()()())())))))()()()((()(()))()()(())()())()))()))))()()()))))))((()))))))))()(()(()((((((()()((()())))))))))))()))())))))((())())(()))())))())))))())()()())(())))())))()())())(())))))))()()(())))()))())))())())())()))))))))()))(()()()())())())))(())())))))))()()())()))))())))())()(())())))))))()())()))(()()(())())))()(()((()()((()()(((((())(()())()))(())()))(())))(())))))))()))()))((()))()))()))))))))()))))))))((()()())(()))(((()))(())))()))((())(((())))()())))())))))((())))))(())())((((((())())()(()))()(()((()())))((())()(()(()))))(())(()()())(())))())((()(((())())))(((()())())))())()(())())((((()()))))())((()))()()()()(())(((((((()()()((()))())(()())))(())())((((()()(()))))()((())))((())()))()(((()))())))()))((()(()))(())(()((((())((((()()(()()))(((())(()))))((((()(()))(())))))((()))(()))((()(((()(()))(()(()((()(())(()(()(()(()()((()))())(((())(()(()))))(()))()()))(())))(())()(((())(()))()((((()()))))())(()))))((())()((((()(((()))())())(((()))()())((())(())())(())()(())()(()()((((((()()))))()()(((()()))))()())()(((()(()))(()(()())(()(()))))(((((()(((())())))))(((((()((()()((())())((((((()(())(()()((()()()()()()()(()()))()(((()))()))(((((((())(((()((()())()((((())(((()(())))()((()(()()()((())((()())()))()))())))())((((((()))(()(()()()))(()((()(()(()))()((()(((()()()((())(((((())()(()))())())((()(())))(()(()())(())((())())())(((()()()(())))))())(()))))))()))))))())((()()()))((()((((((()))(((()((((()()()(((()))())()(()()(((()((()()()()())()()))()()()(()(())((()))))(()))())))))))()(()()(((((())()(()(((((()((()(()()())(()((((((((()((((((())()((((()()()((()((()((((((()))((())))))))())()))((()(()))()(()()(()((())((()()((((((((((((()())(()()()))((((()((((((())(()))())(()()((()()))()(((((((()((()()((((((()(((())))((())))((((((((()()(((((((())(((((()())(((())((())()((((()(((((((()(()(((()((((((()(((()(((((((((((()()((()()(()))((()()(((()(((())))((((())()(()(((())()(()(((())(((((((((((()))())))((((((())((()()((((()())())((((()()))((())(((((()(()()(()()()((())(()((()()((((()(((((()((()(()((((()())((((((()(((((()()(()(()((((())))(())(())(())((((()(()()((((()((((()()((()((((((())))(((((()))))()))(()((((((((()(((())())(((())))(()(()((())(((()((()()(((((()((()()(((())()(()))(((((((())(()(((((()))((()((()((()))(())())((((()((((())()(()))(((()(((((((((((((((())(((((((((()))(((()(()()()()((((((()((())()((((((((()(())(((((((((((()(()((())()((()()(()(()()((((()()((())(()((()()(()()((((()(((((((())))((((())(())()(((()()((()()((((()((()(((()((())(((()()()((((()((((()()(()(()((((((((())(()(((((())(()())(((((((()())()(()((((()((())(()()())((((()()(((()((((())(())(()()(((((((((()()))()(((())(()(()((((((())(()()())(()))()()(((()(((()((())(()(((((((()(()(()((()(((((()(()((()(()((((((()((((()()((((()(((()((())(()(()((()()((((()()(())()(())(((())(()((((((((()())(((((((((()(())()((((())))()))()()(((((()()((((((())(()()(((()(()(((((((()(()(((((((())(())((((()((()(())))((((()()())(()))((()())((((()(((((()(()(())(()(()()())(((((()(((((()((((()()((((((((()()))(()((((((())((((())()(()(((()()()(((()(()(())(())(((((()(())())((((())(())(()(((()(((((())((((())())((()(((((((()(((())(()(()))(((((((((()((()((()()(()((((())(((()((())((((())(()(((()(((()(()((((()(((())(()(((()(()()(()(()((()()(()())(())())((()(()(((()(((()(((()()(((((((((()(((((((((()()(((()(((()())((((()(()(((()()()((())((((((((((())(()(((()((((()())((((()((()))(((()()()(((((()(((((((())((()())(()((((())((((((((())(()((()((((((((((()()((()((()()))(((()())()())()(((()())()()(()(()(((((((())()))(())()))())()()((())()((()((((()((()((())(((((()((((((()(())))(()))())(((()))((()()(()(((()))((((())()(((()))))()(()(())()(((((())(()(()(())(())()((()()()((((()(())((()())(()(()))(()(()(()()(())()()(()((())()((()))))()))((()(()()()()((()())(()))())()(()(((((((((())())((()((()((((((())()((((())(((())((()(()()()((())(()((())(((()((((()()((()(()(((((())()))()((((((()))((())(((()()))(((())(())()))(((((((())(())())()(())(((((()))()((()))()(()()((()()()()()())(((((((') );

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.0060.01616.75
8.3.50.0120.00918.34
8.3.40.0070.00719.05
8.3.30.0150.00418.96
8.3.20.0080.00020.38
8.3.10.0040.00423.66
8.3.00.0120.00319.75
8.2.180.0040.01116.75
8.2.170.0130.01022.96
8.2.160.0070.00720.39
8.2.150.0000.01624.18
8.2.140.0060.00324.66
8.2.130.0090.00021.04
8.2.120.0040.00426.35
8.2.110.0030.00720.99
8.2.100.0090.00317.84
8.2.90.0000.00819.07
8.2.80.0080.00017.97
8.2.70.0000.00917.88
8.2.60.0030.00518.04
8.2.50.0030.00618.07
8.2.40.0030.00522.32
8.2.30.0050.00320.75
8.2.20.0000.00717.75
8.2.10.0000.00717.98
8.2.00.0040.00418.08
8.1.280.0100.01025.92
8.1.270.0070.01320.45
8.1.260.0040.00428.09
8.1.250.0070.00728.09
8.1.240.0110.00021.85
8.1.230.0040.00822.88
8.1.220.0000.00817.74
8.1.210.0070.00318.77
8.1.200.0090.00017.37
8.1.190.0000.00817.35
8.1.180.0060.00318.10
8.1.170.0030.00618.71
8.1.160.0040.00420.67
8.1.150.0040.00418.93
8.1.140.0000.00819.59
8.1.130.0070.00017.74
8.1.120.0050.00217.50
8.1.110.0040.00417.48
8.1.100.0030.00617.59
8.1.90.0000.00817.48
8.1.80.0030.00617.63
8.1.70.0000.00817.51
8.1.60.0030.00517.66
8.1.50.0040.00417.62
8.1.40.0080.00017.75
8.1.30.0030.00517.80
8.1.20.0030.00617.80
8.1.10.0030.00517.75
8.1.00.0030.00617.65
8.0.300.0000.00818.77
8.0.290.0000.00717.00
8.0.280.0070.00018.45
8.0.270.0040.00417.27
8.0.260.0040.00417.26
8.0.250.0070.00017.12
8.0.240.0030.00617.15
8.0.230.0070.00017.17
8.0.220.0040.00417.07
8.0.210.0040.00417.04
8.0.200.0030.00317.15
8.0.190.0060.00617.14
8.0.180.0040.00417.12
8.0.170.0040.00417.14
8.0.160.0040.00417.04
8.0.150.0050.00217.11
8.0.140.0000.00716.97
8.0.130.0000.00613.46
8.0.120.0050.00317.04
8.0.110.0040.00417.04
8.0.100.0030.00516.89
8.0.90.0040.00416.95
8.0.80.0120.00317.08
8.0.70.0080.00017.13
8.0.60.0080.00017.14
8.0.50.0050.00216.94
8.0.30.0160.00516.95
8.0.20.0070.01317.51
8.0.10.0050.00217.22
8.0.00.0100.00817.04
7.4.330.0020.00216.80
7.4.320.0050.00316.77
7.4.300.0060.00016.85
7.4.290.0070.00016.61
7.4.280.0060.00316.84
7.4.270.0030.00316.78
7.4.260.0040.00416.69
7.4.250.0000.00816.84
7.4.240.0040.00316.76
7.4.230.0000.00716.86
7.4.220.0070.01416.83
7.4.210.0110.00316.65
7.4.200.0040.00416.95
7.4.160.0130.00316.75
7.4.150.0060.01217.40
7.4.140.0060.01217.86
7.4.130.0120.00816.81
7.4.120.0050.01216.81
7.4.110.0150.00316.69
7.4.100.0100.01316.60
7.4.90.0100.00716.85
7.4.80.0170.00519.39
7.4.70.0080.00816.58
7.4.60.0060.01216.79
7.4.50.0090.00916.61
7.4.40.0080.00816.78
7.4.30.0050.01416.69
7.4.00.0070.00915.05
7.3.330.0060.00013.51
7.3.320.0000.00513.47
7.3.310.0020.00516.38
7.3.300.0030.00316.52
7.3.290.0100.00616.52
7.3.280.0060.01016.50
7.3.270.0060.01217.40
7.3.260.0130.00616.77
7.3.250.0110.00916.59
7.3.240.0060.01116.73
7.3.230.0140.00416.53
7.3.210.0070.01316.51
7.3.200.0140.00716.49
7.3.190.0100.00616.80
7.3.180.0100.00716.70
7.3.170.0080.00816.72
7.3.160.0070.01016.43
7.3.120.0070.01115.36
7.3.110.0100.00615.18
7.3.100.0070.01014.99
7.3.90.0000.01015.16
7.3.80.0030.01215.03
7.3.70.0070.00715.03
7.3.60.0040.01114.92
7.3.50.0120.00415.08
7.3.40.0030.00914.64
7.3.30.0100.00315.11
7.3.20.0060.00916.77
7.3.10.0060.00916.86
7.3.00.0100.00316.61
7.2.330.0110.00616.80
7.2.320.0070.01716.80
7.2.310.0130.00316.76
7.2.300.0070.01016.89
7.2.290.0110.01116.66
7.2.250.0100.01015.05
7.2.240.0060.01314.87
7.2.230.0000.01115.34
7.2.220.0000.01515.26
7.2.210.0060.00615.28
7.2.200.0060.01015.16
7.2.190.0030.01014.92
7.2.180.0030.01415.08
7.2.170.0030.00714.94
7.2.60.0070.00716.88
7.2.00.0060.00919.45
7.1.330.0090.00615.99
7.1.320.0030.01415.77
7.1.310.0060.00616.13
7.1.300.0070.01015.67
7.1.290.0090.00316.07
7.1.280.0000.01315.80
7.1.270.0110.00315.98
7.1.260.0000.01315.69
7.1.200.0100.00315.76
7.1.100.0070.00417.97
7.1.70.0000.00717.04
7.1.60.0070.01719.52
7.1.50.0070.01317.00
7.1.00.0000.08022.44
7.0.200.0030.00716.76
7.0.60.0070.08019.81
7.0.50.0030.06717.93
7.0.40.0030.04320.31
7.0.30.0330.07020.23
7.0.20.0330.07720.25
7.0.10.0100.08020.20
7.0.00.0100.04020.27
5.6.280.0000.04020.92
5.6.210.0130.07020.66
5.6.200.0030.07318.23
5.6.190.0070.08720.34
5.6.180.0400.05720.61
5.6.170.0170.09020.59
5.6.160.0070.07320.71
5.6.150.0030.04718.27
5.6.140.0000.05318.24
5.6.130.0000.04318.21
5.6.120.0030.04021.02
5.6.110.0170.07020.96
5.6.100.0100.08021.00
5.6.90.0130.05021.10
5.6.80.0130.03020.35
5.5.350.0170.08720.44
5.5.340.0030.05317.96
5.5.330.0100.08320.30
5.5.320.0370.04320.31
5.5.310.0230.06720.29
5.5.300.0030.07718.03
5.5.290.0030.07317.96
5.5.280.0130.07720.73
5.5.270.0270.06720.79
5.5.260.0000.04320.74
5.5.250.0070.07020.71
5.5.240.0300.05020.13

preferences:
64.34 ms | 401 KiB | 5 Q