3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Parenthesis($string) { $opening = array('}' => '{', ']' => '[', ')' => '('); $parens = array(); foreach (str_split($string) as $char) { switch ($char) { case '{': case '[': case '(': $parens[] = $char; break; case '}': case ']': case ')': if (!count($parens) || array_pop($parens) != $opening[$char]) return false; break; default: break; } } return count($parens) === 0; } function check_balanced($string) { echo "$string is " . (Parenthesis($string) ? '' : 'not ') . "balanced\n"; } check_balanced("{([]){}()}"); check_balanced("{C{}[{[a]}RqhL]{y2}}"); check_balanced("{([]){]()}");

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.4.130.0090.00917.72
8.4.120.0130.00822.49
8.4.110.0070.00218.87
8.4.100.0100.01120.72
8.4.90.0100.01020.84
8.4.80.0110.00819.51
8.4.70.0050.00517.74
8.4.60.0090.00718.91
8.4.50.0130.00718.73
8.4.40.0120.00917.56
8.4.30.0030.00620.46
8.4.20.0130.00617.75
8.4.10.0120.00422.27
8.3.260.0100.00916.68
8.3.250.0090.01018.97
8.3.240.0110.00816.68
8.3.230.0120.00216.66
8.3.220.0130.00417.18
8.3.210.0090.00818.27
8.3.200.0040.00516.70
8.3.190.0100.00817.16
8.3.180.0090.00916.85
8.3.170.0130.00617.16
8.3.160.0120.00618.29
8.3.150.0040.00420.80
8.3.140.0040.01218.25
8.3.130.0080.00016.83
8.3.120.0150.00018.96
8.3.110.0040.01120.94
8.3.100.0090.00024.06
8.3.90.0140.00726.77
8.3.80.0090.00019.36
8.3.70.0070.01418.27
8.3.60.0070.01016.50
8.3.50.0110.00924.47
8.3.40.0150.00618.87
8.3.30.0070.01118.88
8.3.20.0000.00824.18
8.3.10.0070.00024.66
8.3.00.0050.00326.16
8.2.290.0090.01020.68
8.2.280.0130.00518.46
8.2.270.0040.00417.22
8.2.260.0110.00718.61
8.2.250.0090.00918.34
8.2.240.0060.00316.98
8.2.230.0060.00322.58
8.2.220.0030.00737.54
8.2.210.0000.00726.77
8.2.200.0000.01118.88
8.2.190.0110.00318.54
8.2.180.0110.00425.92
8.2.170.0170.00319.09
8.2.160.0070.01122.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0030.00626.35
8.2.110.0030.00720.38
8.2.100.0110.00017.91
8.2.90.0030.00618.22
8.2.80.0060.00318.28
8.2.70.0050.00317.50
8.2.60.0000.00817.63
8.2.50.0030.00719.35
8.2.40.0000.00917.75
8.2.30.0030.00618.26
8.2.20.0040.00418.11
8.2.10.0000.00719.15
8.2.00.0000.00719.18
8.1.330.0100.00722.01
8.1.320.0120.00816.35
8.1.310.0040.00418.52
8.1.300.0150.00018.45
8.1.290.0030.00630.84
8.1.280.0070.01025.92
8.1.270.0000.00723.99
8.1.260.0080.00028.09
8.1.250.0000.00928.09
8.1.240.0090.00020.96
8.1.230.0080.00420.72
8.1.220.0030.00617.74
8.1.210.0000.00718.99
8.1.200.0040.00417.10
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0030.00718.54
8.1.160.0000.00718.88
8.1.150.0000.00718.98
8.1.140.0040.00418.93
8.1.130.0030.00320.21
8.1.120.0030.00617.42
8.1.110.0040.00417.39
8.1.100.0040.00417.48
8.1.90.0040.00417.41
8.1.80.0000.01017.52
8.1.70.0030.00317.41
8.1.60.0080.00017.65
8.1.50.0040.00417.58
8.1.40.0040.00417.46
8.1.30.0040.00417.70
8.1.20.0040.00417.68
8.1.10.0030.00617.55
8.1.00.0000.00817.50
8.0.300.0000.00819.88
8.0.290.0040.00416.63
8.0.280.0030.00318.48
8.0.270.0000.01018.08
8.0.260.0000.00618.44
8.0.250.0040.00416.97
8.0.240.0030.00317.02
8.0.230.0040.00716.85
8.0.220.0080.00016.83
8.0.210.0000.00716.89
8.0.200.0070.00017.00
8.0.190.0040.00416.96
8.0.180.0000.00816.80
8.0.170.0080.00016.86
8.0.160.0000.00817.02
8.0.150.0030.00616.81
8.0.140.0040.00416.86
8.0.130.0000.00613.32
8.0.120.0050.00316.79
8.0.110.0070.00016.87
8.0.100.0080.00016.71
8.0.90.0040.00416.95
8.0.80.0110.01016.90
8.0.70.0040.00416.86
8.0.60.0000.00716.96
8.0.50.0040.00416.97
8.0.30.0160.00517.25
8.0.20.0080.01017.11
8.0.10.0080.01216.97
8.0.00.0140.00516.86
7.4.330.0020.00216.67
7.4.320.0040.00416.44
7.4.300.0060.00016.46
7.4.290.0030.00316.48
7.4.280.0040.00416.42
7.4.270.0040.00516.58
7.4.260.0000.00513.25
7.4.250.0070.00016.58
7.4.240.0040.00316.52
7.4.230.0030.00516.71
7.4.220.0030.00516.38
7.4.210.0100.00416.61
7.4.200.0050.00316.70
7.4.150.0030.01616.58
7.4.140.0110.00616.65
7.4.130.0120.00616.55
7.4.120.0100.01016.41
7.4.110.0140.00316.46
7.4.100.0030.01516.29
7.4.90.0190.00016.18
7.4.80.0060.01216.25
7.4.70.0100.00716.15
7.4.60.0120.00616.21
7.4.50.0110.00716.58
7.4.40.0190.00616.37
7.4.30.0100.00716.41
7.4.20.0090.00916.29
7.4.10.0090.00816.04
7.4.00.0140.01016.37
7.3.330.0000.00716.17
7.3.320.0030.00313.07
7.3.310.0000.00716.19
7.3.300.0000.00616.25
7.3.290.0120.00316.32
7.3.270.0100.00716.45
7.3.260.0100.00716.45
7.3.250.0040.01316.33
7.3.240.0170.00016.38
7.3.230.0090.00916.32
7.3.220.0110.00716.56
7.3.210.0090.00916.34
7.3.200.0100.00716.28
7.3.190.0030.01416.39
7.3.180.0040.01416.18
7.3.170.0100.01016.59
7.3.160.0140.01116.39
7.3.150.0190.00016.47
7.3.140.0070.01016.20
7.3.130.0100.01416.29
7.3.120.0150.00916.37
7.3.110.0070.01716.41
7.3.100.0090.01516.37
7.3.90.0170.00716.30
7.3.80.0070.01316.25
7.3.70.0070.01316.40
7.3.60.0090.00916.27
7.3.50.0090.00916.34
7.3.40.0110.01116.09
7.3.30.0130.01016.42
7.3.20.0060.01316.06
7.3.10.0290.00316.31
7.3.00.0060.01116.35

preferences:
28.63 ms | 403 KiB | 5 Q