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.0080.01116.75
8.3.50.0040.01118.48
8.3.40.0070.01119.22
8.3.30.0060.01319.05
8.3.20.0050.00320.30
8.3.10.0060.00323.64
8.3.00.0040.00419.97
8.2.180.0120.00316.75
8.2.170.0080.00822.96
8.2.160.0060.00820.57
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00019.39
8.2.120.0090.00026.35
8.2.110.0040.00422.18
8.2.100.0120.00017.80
8.2.90.0040.00419.04
8.2.80.0000.00817.97
8.2.70.0080.00017.88
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0000.00822.19
8.2.30.0050.00320.69
8.2.20.0040.00417.75
8.2.10.0000.00717.98
8.2.00.0000.00718.18
8.1.280.0100.01025.92
8.1.270.0070.01320.22
8.1.260.0050.00328.09
8.1.250.0090.00028.09
8.1.240.0030.00623.88
8.1.230.0040.00719.34
8.1.220.0050.00317.79
8.1.210.0060.00318.77
8.1.200.0000.00917.48
8.1.190.0000.00917.23
8.1.180.0050.00318.10
8.1.170.0030.00618.90
8.1.160.0000.00820.76
8.1.150.0000.00818.89
8.1.140.0030.00519.48
8.1.130.0050.00217.61
8.1.120.0040.00417.61
8.1.110.0020.00517.60
8.1.100.0080.00017.63
8.1.90.0040.00417.51
8.1.80.0040.00417.57
8.1.70.0030.00517.45
8.1.60.0030.00517.66
8.1.50.0040.00417.73
8.1.40.0000.00817.71
8.1.30.0030.00617.72
8.1.20.0000.00817.80
8.1.10.0040.00417.78
8.1.00.0000.00817.55
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0070.00018.35
8.0.270.0070.00017.27
8.0.260.0030.00517.21
8.0.250.0030.00317.08
8.0.240.0040.00417.04
8.0.230.0000.00717.17
8.0.220.0030.00317.07
8.0.210.0030.00617.11
8.0.200.0000.00717.00
8.0.190.0090.00017.01
8.0.180.0040.00417.14
8.0.170.0080.00017.11
8.0.160.0000.00717.05
8.0.150.0080.00017.06
8.0.140.0050.00316.97
8.0.130.0030.00313.46
8.0.120.0080.00017.05
8.0.110.0000.00816.94
8.0.100.0000.00816.88
8.0.90.0080.00017.07
8.0.80.0060.01217.14
8.0.70.0000.00717.11
8.0.60.0040.00417.04
8.0.50.0030.00617.11
8.0.30.0070.01117.47
8.0.20.0130.00517.42
8.0.10.0040.00417.03
8.0.00.0070.01317.04
7.4.330.0000.00516.79
7.4.320.0090.00016.87
7.4.300.0070.00016.84
7.4.290.0070.00016.70
7.4.280.0040.00416.63
7.4.270.0000.00816.86
7.4.260.0030.00316.83
7.4.250.0000.00916.84
7.4.240.0050.00316.76
7.4.230.0000.00716.96
7.4.220.0110.00716.79
7.4.210.0060.01316.88
7.4.200.0080.00016.77
7.4.160.0100.00616.80
7.4.150.0090.00917.40
7.4.140.0100.01017.86
7.4.130.0100.00816.80
7.4.120.0060.01216.70
7.4.110.0070.01116.61
7.4.100.0100.01316.85
7.4.90.0110.00716.70
7.4.80.0110.01119.39
7.4.70.0100.00916.63
7.4.60.0130.00316.80
7.4.50.0070.00716.53
7.4.40.0140.01016.97
7.4.30.0110.00716.55
7.4.00.0100.00715.11
7.3.330.0030.00313.52
7.3.320.0000.00513.48
7.3.310.0000.00916.38
7.3.300.0000.00716.51
7.3.290.0050.01116.52
7.3.280.0080.00716.51
7.3.270.0200.00317.40
7.3.260.0030.01516.65
7.3.250.0100.01016.69
7.3.240.0090.00716.69
7.3.230.0060.01216.52
7.3.210.0100.00716.60
7.3.200.0060.01216.57
7.3.190.0030.01516.50
7.3.180.0040.01516.63
7.3.170.0130.00316.89
7.3.160.0130.00316.48
7.3.120.0070.01114.73
7.3.110.0120.00615.20
7.3.100.0060.01015.21
7.3.90.0040.01115.26
7.3.80.0070.01114.91
7.3.70.0060.00614.89
7.3.60.0030.01415.08
7.3.50.0000.01414.97
7.3.40.0060.00915.05
7.3.30.0100.00714.88
7.3.20.0130.00616.95
7.3.10.0050.01316.60
7.3.00.0100.00616.71
7.2.330.0180.00916.79
7.2.320.0090.01616.82
7.2.310.0090.00916.70
7.2.300.0070.01016.82
7.2.290.0190.00316.85
7.2.250.0130.00015.30
7.2.240.0070.01315.13
7.2.230.0110.00315.32
7.2.220.0040.00815.30
7.2.210.0050.00514.97
7.2.200.0070.01014.86
7.2.190.0070.01015.32
7.2.180.0070.00715.21
7.2.170.0030.01315.19
7.2.130.0150.00616.95
7.2.120.0120.00816.57
7.2.110.0110.00616.75
7.2.100.0100.00516.83
7.2.90.0100.01016.94
7.2.80.0160.00316.63
7.2.70.0140.00416.83
7.2.60.0090.00716.76
7.2.50.0030.01417.00
7.2.40.0110.01116.73
7.2.30.0120.00616.73
7.2.20.0140.00716.75
7.2.10.0100.01016.94
7.2.00.0130.00418.32
7.1.330.0030.01215.89
7.1.320.0000.01115.93
7.1.310.0000.01315.98
7.1.300.0030.01415.96
7.1.290.0000.01415.93
7.1.280.0110.00415.98
7.1.270.0120.00316.01
7.1.260.0030.01515.70
7.1.250.0200.00015.64
7.1.200.0080.00715.89
7.1.100.0030.00918.21
7.1.70.0030.00617.23
7.1.60.0030.02019.52
7.1.50.0040.01617.00
7.1.00.0030.07722.35
7.0.200.0000.01016.90
7.0.60.0130.06020.00
7.0.50.0070.08317.92
7.0.40.0130.04319.98
7.0.30.0230.07720.17
7.0.20.0270.05320.31
7.0.10.0030.09320.11
7.0.00.0100.03720.27
5.6.280.0070.03321.10
5.6.210.0100.03720.61
5.6.200.0100.04018.14
5.6.190.0030.06320.50
5.6.180.0330.05020.43
5.6.170.0370.06020.44
5.6.160.0130.07320.57
5.6.150.0130.07718.25
5.6.140.0100.07318.17
5.6.130.0030.04718.14
5.6.120.0100.03321.11
5.6.110.0100.06020.98
5.6.100.0070.08721.04
5.6.90.0000.06720.97
5.6.80.0070.07020.52
5.5.350.0130.03320.30
5.5.340.0000.04018.09
5.5.330.0030.07020.31
5.5.320.0370.04020.31
5.5.310.0270.06320.36
5.5.300.0100.08018.07
5.5.290.0100.05318.09
5.5.280.0070.04020.88
5.5.270.0070.04720.79
5.5.260.0070.03720.88
5.5.250.0100.09020.58
5.5.240.0100.06320.35

preferences:
35.1 ms | 400 KiB | 5 Q