3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isCorrect($string) { $len = strlen($string); $stack = array(); for( $i = 0; $i < $len; ++$i) { if ( $string[$i] == '(' || $string[$i] == '{' || $string[$i] == '[') array_push($stack, $string[$i]); elseif( $string[$i] == ')' || $string[$i] == '}' || $string[$i] == ']') { if ( empty($stack) === false ) array_pop($stack); else return false; } } return empty($stack); } $string = '()]((({{{}}})))'; var_dump(isCorrect($string)); //var_dump(isCorrect($string)); //var_dump(strlen($string) % 2); //assert(isCorrect('') === true); //assert(isCorrect('()') === true); //assert(isCorrect('{()}') === true); //assert(isCorrect('{()}{}') === true); //assert(isCorrect('(())') === true); //assert(isCorrect('{({({({()})})})}') === true); //assert(isCorrect('{(})') === false);

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.0140.00718.43
8.3.50.0160.00222.04
8.3.40.0120.00618.71
8.3.30.0000.01419.23
8.3.20.0030.00520.34
8.3.10.0000.00723.43
8.3.00.0050.00319.25
8.2.180.0090.00616.88
8.2.170.0070.00722.96
8.2.160.0070.00720.32
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0050.00226.16
8.2.120.0060.00322.23
8.2.110.0090.00021.94
8.2.100.0090.00317.63
8.2.90.0040.00419.03
8.2.80.0080.00017.97
8.2.70.0060.00217.75
8.2.60.0040.00418.05
8.2.50.0030.00518.07
8.2.40.0050.00319.97
8.2.30.0030.01018.06
8.2.20.0040.00417.83
8.2.10.0050.00318.15
8.2.00.0000.00717.64
8.1.280.0110.00425.92
8.1.270.0080.00023.88
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00324.03
8.1.230.0030.00719.01
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0030.00717.22
8.1.190.0080.00017.22
8.1.180.0080.00018.10
8.1.170.0050.00318.49
8.1.160.0000.00721.94
8.1.150.0070.00018.79
8.1.140.0000.00717.47
8.1.130.0070.00017.96
8.1.120.0040.00417.39
8.1.110.0040.00417.56
8.1.100.0040.00417.39
8.1.90.0030.00617.47
8.1.80.0040.00417.50
8.1.70.0070.00017.41
8.1.60.0030.00617.58
8.1.50.0080.00017.50
8.1.40.0040.00417.46
8.1.30.0030.00617.57
8.1.20.0040.00417.64
8.1.10.0000.00717.58
8.1.00.0040.00417.57
8.0.300.0000.00718.77
8.0.290.0000.00716.63
8.0.280.0070.00018.38
8.0.270.0000.00817.19
8.0.260.0070.00017.28
8.0.250.0040.00417.01
8.0.240.0070.00016.95
8.0.230.0000.01016.98
8.0.220.0070.00016.83
8.0.210.0000.00716.82
8.0.200.0000.00816.87
8.0.190.0000.00816.95
8.0.180.0040.00416.92
8.0.170.0080.00016.89
8.0.160.0070.00016.94
8.0.150.0070.00016.84
8.0.140.0030.00516.84
8.0.130.0030.00313.38
8.0.120.0080.00016.86
8.0.110.0000.00816.89
8.0.100.0000.00716.79
8.0.90.0040.00416.70
8.0.80.0090.00616.86
8.0.70.0020.00516.91
8.0.60.0030.00316.73
8.0.50.0040.00416.77
8.0.30.0160.00317.31
8.0.20.0170.00617.40
8.0.10.0040.00417.08
8.0.00.0070.00916.87
7.4.330.0000.00415.02
7.4.320.0070.00016.60
7.4.300.0030.00316.52
7.4.290.0000.00716.54
7.4.280.0040.00416.51
7.4.270.0000.00616.53
7.4.260.0030.00316.50
7.4.250.0000.00716.61
7.4.240.0040.00416.62
7.4.230.0030.00316.42
7.4.220.0180.00316.64
7.4.210.0090.00616.56
7.4.200.0000.00716.51
7.4.160.0040.01516.61
7.4.150.0120.00817.40
7.4.140.0050.01617.86
7.4.130.0050.01516.45
7.4.120.0100.01016.54
7.4.110.0120.00916.48
7.4.100.0060.01316.67
7.4.90.0030.01316.61
7.4.80.0100.00719.39
7.4.70.0130.00316.65
7.4.60.0090.00916.68
7.4.50.0040.00416.66
7.4.40.0070.01016.55
7.4.30.0090.01316.36
7.4.00.0060.01015.15
7.3.330.0000.00513.16
7.3.320.0050.00013.21
7.3.310.0000.00716.30
7.3.300.0060.00016.26
7.3.290.0060.00916.40
7.3.280.0070.00916.37
7.3.270.0090.00917.40
7.3.260.0000.01616.33
7.3.250.0130.00716.49
7.3.240.0080.00816.43
7.3.230.0120.00616.49
7.3.210.0030.01316.60
7.3.200.0130.00319.39
7.3.190.0120.00616.30
7.3.180.0030.01316.65
7.3.170.0080.00816.43
7.3.160.0060.01016.48
7.3.120.0070.01015.12
7.3.110.0080.00414.88
7.3.100.0070.01114.97
7.3.90.0060.00914.59
7.3.80.0110.00315.21
7.3.70.0030.01014.97
7.3.60.0060.00614.89
7.3.50.0040.01215.01
7.3.40.0030.01314.56
7.3.30.0070.00715.01
7.3.20.0030.01016.68
7.3.10.0040.00916.72
7.3.00.0070.00516.55
7.2.330.0130.00316.63
7.2.320.0160.00616.81
7.2.310.0000.01716.79
7.2.300.0110.00616.74
7.2.290.0000.01616.85
7.2.250.0120.00615.05
7.2.240.0040.01514.68
7.2.230.0070.00315.34
7.2.220.0070.00714.96
7.2.210.0000.01415.23
7.2.200.0110.00315.02
7.2.190.0090.00614.96
7.2.180.0040.01415.14
7.2.170.0000.01415.10
7.2.130.0070.00317.10
7.2.120.0090.00617.04
7.2.110.0080.00416.90
7.2.100.0040.00816.88
7.2.90.0030.01017.11
7.2.80.0000.01416.91
7.2.70.0070.00716.86
7.2.60.0050.01016.91
7.2.50.0070.00317.09
7.2.40.0030.00916.87
7.2.30.0070.00716.96
7.2.20.0100.00016.96
7.2.10.0040.00716.91
7.2.00.0030.00618.12
7.1.330.0030.00915.79
7.1.320.0050.00515.53
7.1.310.0060.00615.79
7.1.300.0040.00715.80
7.1.290.0060.00615.77
7.1.280.0100.00315.80
7.1.270.0040.00815.76
7.1.260.0040.01215.62
7.1.250.0120.00015.56
7.1.200.0040.00415.95
7.1.100.0800.00616.14
7.1.70.0080.00017.19
7.1.60.0040.01419.11
7.1.50.0070.01416.77
7.1.00.0070.07322.54
7.0.200.0030.00616.81
7.0.140.0100.06722.12
7.0.60.0130.04319.94
7.0.50.0130.06317.72
7.0.40.0100.04020.11
7.0.30.0200.04020.26
7.0.20.0370.04720.23
7.0.10.0170.08020.09
7.0.00.0100.08320.02
5.6.280.0100.06721.08
5.6.210.0030.08020.63
5.6.200.0070.04718.14
5.6.190.0100.08320.52
5.6.180.0170.05720.55
5.6.170.0370.07020.52
5.6.160.0100.05020.55
5.6.150.0100.03318.19
5.6.140.0100.07718.20
5.6.130.0030.08018.24
5.6.120.0130.07321.04
5.6.110.0070.03720.99
5.6.100.0130.08021.15
5.6.90.0070.07721.04
5.6.80.0100.07720.55
5.5.350.3900.04320.50
5.5.340.0100.08317.96
5.5.330.0100.05720.43
5.5.320.0230.08320.20
5.5.310.0200.04020.24
5.5.300.0030.06317.98
5.5.290.0070.03717.99
5.5.280.0100.09020.65
5.5.270.0130.08020.79
5.5.260.0000.05020.76
5.5.250.0130.06320.69
5.5.240.0130.07020.19
5.4.450.0530.06319.61
5.4.440.0700.05719.20
5.4.430.0100.06319.43
5.4.420.0670.00019.38
5.4.410.0630.00019.11
5.4.400.0630.00019.08
5.4.390.0630.00019.06
5.4.380.0630.00019.04
5.4.370.0630.00019.07
5.4.360.0700.00019.08
5.4.350.0670.00019.09
5.4.340.0080.03912.02
5.4.320.0060.05212.51
5.4.310.0120.04112.50
5.4.300.0080.03912.51
5.4.290.0050.04012.50
5.4.280.0070.03812.40
5.4.270.0070.03512.40
5.4.260.0100.03412.40
5.4.250.0060.03812.40
5.4.240.0110.03212.39
5.4.230.0070.03812.39
5.4.220.0080.03512.39
5.4.210.0060.03612.39
5.4.200.0070.04112.39
5.4.190.0100.03512.38
5.4.180.0070.03612.39
5.4.170.0080.03712.39
5.4.160.0100.03112.39
5.4.150.0060.03512.39
5.4.140.0060.03812.07
5.4.130.0040.03912.05
5.4.120.0070.03512.02
5.4.110.0100.03212.02
5.4.100.0060.03512.02
5.4.90.0050.03912.01
5.4.80.0110.04612.02
5.4.70.0070.04912.00
5.4.60.0170.04212.01
5.4.50.0150.04012.01
5.4.40.0060.03512.00
5.4.30.0080.03412.00
5.4.20.0120.03211.99
5.4.10.0110.03211.99
5.4.00.0110.03511.48
5.3.290.0090.03912.80
5.3.280.0080.04012.71
5.3.270.0100.03712.73
5.3.260.0040.04112.72
5.3.250.0080.04312.72
5.3.240.0060.03912.72
5.3.230.0060.04212.71
5.3.220.0090.04012.68
5.3.210.0070.04412.68
5.3.200.0040.03912.68
5.3.190.0090.03512.68
5.3.180.0070.03712.67
5.3.170.0050.04012.67
5.3.160.0080.04012.67
5.3.150.0070.05212.67
5.3.140.0030.04112.66
5.3.130.0030.04112.66
5.3.120.0050.03912.66
5.3.110.0070.03812.66
5.3.100.0070.03512.12
5.3.90.0050.04112.10
5.3.80.0060.03912.09
5.3.70.0050.04012.09
5.3.60.0070.04212.07
5.3.50.0030.04412.02
5.3.40.0050.04112.02
5.3.30.0040.03711.98
5.3.20.0040.03811.76
5.3.10.0070.03311.73
5.3.00.0100.05511.72
5.2.170.0060.0339.21
5.2.160.0070.0309.21
5.2.150.0050.0319.21
5.2.140.0080.0409.21
5.2.130.0080.0339.17
5.2.120.0080.0339.17
5.2.110.0080.0309.18
5.2.100.0050.0309.18
5.2.90.0040.0359.18
5.2.80.0080.0319.17
5.2.70.0100.0309.17
5.2.60.0060.0369.13
5.2.50.0080.0299.09
5.2.40.0070.0309.07
5.2.30.0020.0329.04
5.2.20.0010.0329.04
5.2.10.0060.0278.94
5.2.00.0050.0298.81
5.1.60.0030.0258.09
5.1.50.0050.0248.09
5.1.40.0060.0238.06
5.1.30.0050.0268.41
5.1.20.0030.0288.43
5.1.10.0090.0228.16
5.1.00.0050.0268.16
5.0.50.0040.0206.65
5.0.40.0040.0196.52
5.0.30.0020.0336.33
5.0.20.0040.0196.29
5.0.10.0030.0216.27
5.0.00.0060.0286.27
4.4.90.0040.0144.78
4.4.80.0010.0174.76
4.4.70.0030.0154.75
4.4.60.0040.0144.75
4.4.50.0030.0154.77
4.4.40.0020.0264.71
4.4.30.0000.0184.76
4.4.20.0020.0164.85
4.4.10.0040.0144.85
4.4.00.0010.0264.76
4.3.110.0040.0144.67
4.3.100.0010.0164.67
4.3.90.0020.0154.64
4.3.80.0010.0264.58
4.3.70.0040.0144.63
4.3.60.0020.0154.63
4.3.50.0040.0144.63
4.3.40.0020.0264.54
4.3.30.0040.0153.32
4.3.20.0010.0173.30
4.3.10.0000.0183.26
4.3.00.0070.0276.72

preferences:
43.96 ms | 401 KiB | 5 Q