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.70.0140.00016.66
8.3.60.0150.00616.50
8.3.50.0140.00922.09
8.3.40.0000.01419.09
8.3.30.0210.00018.95
8.3.20.0080.00020.30
8.3.10.0050.00323.48
8.3.00.0000.00719.98
8.2.190.0030.01118.28
8.2.180.0120.00316.38
8.2.170.0150.00622.96
8.2.160.0100.01020.25
8.2.150.0030.00624.18
8.2.140.0050.00324.66
8.2.130.0080.00019.26
8.2.120.0040.00426.35
8.2.110.0090.00022.23
8.2.100.0040.00817.91
8.2.90.0030.00619.27
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0050.00317.80
8.2.50.0040.00418.07
8.2.40.0040.00422.34
8.2.30.0070.00020.65
8.2.20.0000.00717.85
8.2.10.0020.00517.98
8.2.00.0070.00017.96
8.1.280.0140.00425.92
8.1.270.0150.00020.29
8.1.260.0040.00428.09
8.1.250.0090.00028.09
8.1.240.0100.01023.77
8.1.230.0080.00418.95
8.1.220.0040.00417.74
8.1.210.0040.00718.77
8.1.200.0040.00417.48
8.1.190.0000.00817.25
8.1.180.0040.00418.10
8.1.170.0030.00518.59
8.1.160.0040.00420.79
8.1.150.0070.00018.88
8.1.140.0000.00819.59
8.1.130.0000.00717.64
8.1.120.0000.00717.60
8.1.110.0020.00517.60
8.1.100.0000.00817.52
8.1.90.0030.00517.52
8.1.80.0000.00817.43
8.1.70.0040.00417.43
8.1.60.0090.00017.82
8.1.50.0040.00417.61
8.1.40.0000.00817.72
8.1.30.0000.00917.77
8.1.20.0000.00717.67
8.1.10.0040.00417.81
8.1.00.0040.00417.68
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0030.00318.48
8.0.270.0000.00717.17
8.0.260.0030.00317.16
8.0.250.0030.00317.08
8.0.240.0000.00717.14
8.0.230.0040.00417.14
8.0.220.0000.00816.95
8.0.210.0000.00717.05
8.0.200.0040.00417.12
8.0.190.0030.00717.09
8.0.180.0070.00017.11
8.0.170.0050.00317.00
8.0.160.0000.00817.09
8.0.150.0040.00417.06
8.0.140.0050.00216.90
8.0.130.0030.00313.50
8.0.120.0060.00316.92
8.0.110.0000.00816.92
8.0.100.0000.00717.12
8.0.90.0000.00817.04
8.0.80.0030.01017.02
8.0.70.0050.00217.08
8.0.60.0040.00417.06
8.0.50.0080.00016.94
8.0.30.0130.01017.35
8.0.20.0100.00917.47
8.0.10.0040.00417.23
8.0.00.0100.00717.00
7.4.330.0030.00316.80
7.4.320.0000.00816.73
7.4.300.0000.00616.83
7.4.290.0030.00316.68
7.4.280.0060.00316.74
7.4.270.0030.00316.84
7.4.260.0000.00816.65
7.4.250.0050.00216.71
7.4.240.0030.00516.74
7.4.230.0070.00016.67
7.4.220.0070.01016.87
7.4.210.0030.01216.92
7.4.200.0040.00416.48
7.4.160.0120.00616.68
7.4.150.0070.01617.40
7.4.140.0100.00817.86
7.4.130.0110.00616.77
7.4.120.0120.00616.71
7.4.110.0110.00716.59
7.4.100.0050.01716.72
7.4.90.0030.01316.70
7.4.80.0100.01019.39
7.4.70.0090.00816.77
7.4.60.0000.01916.79
7.4.50.0070.00716.37
7.4.40.0090.00916.90
7.4.30.0110.00816.91
7.4.00.0070.00714.95
7.3.330.0000.00513.49
7.3.320.0050.00013.51
7.3.310.0040.00416.40
7.3.300.0030.00316.50
7.3.290.0050.01116.53
7.3.280.0080.00916.51
7.3.270.0070.01617.40
7.3.260.0000.01716.52
7.3.250.0080.01116.54
7.3.240.0090.00816.69
7.3.230.0130.01016.70
7.3.210.0090.00916.63
7.3.200.0130.00316.50
7.3.190.0100.00716.58
7.3.180.0100.00716.50
7.3.170.0080.00816.55
7.3.160.0090.00616.64
7.2.330.0100.00616.77
7.2.320.0060.01616.60
7.2.310.0070.01116.82
7.2.300.0140.00416.92
7.2.290.0090.01216.88
7.2.60.0060.00916.80
7.2.00.0000.01219.63
7.1.200.0000.01415.88
7.1.100.0120.00418.00
7.1.70.0000.00917.23
7.1.60.0060.01819.52
7.1.50.0150.00617.00
7.1.00.0030.07722.32
7.0.200.0040.00416.62
7.0.60.0070.06719.96
7.0.50.0000.04318.02
7.0.40.0130.03320.07
7.0.30.0270.08020.25
7.0.20.0300.04320.09
7.0.10.0170.07320.08
7.0.00.0130.08020.10
5.6.280.0030.05321.13
5.6.210.0100.05320.53
5.6.200.0070.05018.12
5.6.190.0030.08320.50
5.6.180.0370.07320.57
5.6.170.0300.04320.51
5.6.160.0170.07020.55
5.6.150.0100.07718.22
5.6.140.0070.07718.16
5.6.130.0100.08318.18
5.6.120.0070.03720.98
5.6.110.0030.06021.11
5.6.100.0030.05321.01
5.6.90.0000.09021.13
5.6.80.0130.04320.51
5.5.350.0330.03720.41
5.5.340.0000.04017.98
5.5.330.0000.09320.32
5.5.320.0300.04320.35
5.5.310.0230.03720.19
5.5.300.0070.08317.99
5.5.290.0030.04317.91
5.5.280.0030.04320.88
5.5.270.0030.08720.86
5.5.260.0070.04020.84
5.5.250.0100.08020.70
5.5.240.0200.05320.26

preferences:
51.48 ms | 401 KiB | 5 Q