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] == '(' ) array_push($stack, $string[$i]); elseif( $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.0160.00318.30
8.3.50.0110.00921.21
8.3.40.0150.00318.54
8.3.30.0110.00319.09
8.3.20.0040.00420.07
8.3.10.0040.00423.36
8.3.00.0060.00319.38
8.2.180.0070.01116.75
8.2.170.0150.00622.96
8.2.160.0040.01120.27
8.2.150.0000.00724.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00822.09
8.2.110.0070.01120.47
8.2.100.0080.00417.72
8.2.90.0050.00318.16
8.2.80.0000.00817.97
8.2.70.0030.00517.63
8.2.60.0000.00817.80
8.2.50.0000.00818.07
8.2.40.0030.00519.79
8.2.30.0090.00018.13
8.2.20.0080.00017.68
8.2.10.0040.00417.98
8.2.00.0040.00417.68
8.1.280.0070.00725.92
8.1.270.0000.00923.84
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00622.04
8.1.230.0040.00720.88
8.1.220.0000.00817.74
8.1.210.0000.00818.78
8.1.200.0040.00417.11
8.1.190.0060.00317.13
8.1.180.0040.00418.10
8.1.170.0000.00818.71
8.1.160.0040.00421.89
8.1.150.0040.00418.79
8.1.140.0040.00417.45
8.1.130.0040.00417.80
8.1.120.0040.00417.47
8.1.110.0000.00817.49
8.1.100.0000.00717.47
8.1.90.0070.00017.35
8.1.80.0050.00317.52
8.1.70.0030.00317.34
8.1.60.0090.00017.46
8.1.50.0000.00817.44
8.1.40.0040.00417.48
8.1.30.0000.00817.59
8.1.20.0070.00017.50
8.1.10.0000.00717.55
8.1.00.0050.00217.47
8.0.300.0070.00020.14
8.0.290.0040.00416.75
8.0.280.0030.00318.44
8.0.270.0030.00317.23
8.0.260.0030.00317.19
8.0.250.0030.00316.84
8.0.240.0030.00316.92
8.0.230.0090.00016.95
8.0.220.0030.00316.76
8.0.210.0030.00316.74
8.0.200.0000.00716.78
8.0.190.0000.00816.84
8.0.180.0040.00416.83
8.0.170.0040.00416.90
8.0.160.0030.00516.74
8.0.150.0040.00416.75
8.0.140.0000.00716.84
8.0.130.0030.00313.22
8.0.120.0000.00916.84
8.0.110.0000.00716.95
8.0.100.0000.00716.85
8.0.90.0000.00716.76
8.0.80.0130.00316.95
8.0.70.0080.00016.96
8.0.60.0000.00716.91
8.0.50.0040.00416.93
8.0.30.0110.00817.01
8.0.20.0130.01417.40
8.0.10.0070.00016.89
8.0.00.0080.01016.80
7.4.330.0030.00315.02
7.4.320.0030.00316.55
7.4.300.0060.00016.55
7.4.290.0030.00316.63
7.4.280.0040.00716.45
7.4.270.0030.00316.62
7.4.260.0040.00416.61
7.4.250.0000.00716.56
7.4.240.0050.00216.51
7.4.230.0070.00016.61
7.4.220.0120.00616.54
7.4.210.0000.01416.59
7.4.200.0030.00316.48
7.4.160.0130.00316.41
7.4.150.0090.01017.40
7.4.140.0090.01217.86
7.4.130.0090.00816.35
7.4.120.0080.01016.40
7.4.110.0100.00716.48
7.4.100.0230.00016.66
7.4.90.0070.01016.48
7.4.80.0150.00919.39
7.4.70.0120.00916.62
7.4.60.0030.01316.60
7.4.50.0040.00416.54
7.4.40.0070.01016.66
7.4.30.0140.00716.64
7.4.00.0120.00614.94
7.3.330.0050.00013.19
7.3.320.0000.00613.20
7.3.310.0040.00416.39
7.3.300.0070.00016.37
7.3.290.0060.00816.37
7.3.280.0130.00316.38
7.3.270.0120.00617.40
7.3.260.0040.01816.60
7.3.250.0130.00816.49
7.3.240.0100.00716.55
7.3.230.0090.00916.66
7.3.210.0100.00716.32
7.3.200.0120.00819.39
7.3.190.0090.01316.57
7.3.180.0100.00616.29
7.3.170.0080.00816.48
7.3.160.0120.00316.33
7.3.120.0030.01414.84
7.3.110.0000.01614.99
7.3.100.0030.00715.04
7.3.90.0040.01214.82
7.3.80.0070.00714.64
7.3.70.0060.00614.73
7.3.60.0020.00514.87
7.3.50.0060.00314.92
7.3.40.0000.00914.80
7.3.30.0080.00414.89
7.3.20.0060.00616.62
7.3.10.0110.00316.45
7.3.00.0050.00916.51
7.2.330.0130.00316.48
7.2.320.0080.01116.79
7.2.310.0100.01116.86
7.2.300.0060.01016.63
7.2.290.0140.00316.84
7.2.240.0060.00614.83
7.2.230.0090.00615.29
7.2.220.0060.01114.91
7.2.210.0000.01515.10
7.2.200.0040.00715.14
7.2.190.0000.01114.95
7.2.180.0040.00814.74
7.2.170.0070.01014.96
7.2.160.0040.01215.00
7.2.150.0040.01116.91
7.2.140.0100.00716.91
7.2.130.0100.00416.72
7.2.120.0060.01016.65
7.2.110.0080.00616.89
7.2.100.0100.00716.69
7.2.90.0100.00716.85
7.2.80.0050.01116.76
7.2.70.0090.00716.73
7.2.60.0110.00616.80
7.2.50.0060.01016.93
7.2.40.0050.00916.72
7.2.30.0110.00616.75
7.2.20.0050.01016.80
7.2.10.0080.00716.80
7.2.00.0070.01017.38
7.1.330.0030.01315.48
7.1.320.0060.00615.72
7.1.310.0030.01415.83
7.1.300.0060.00615.54
7.1.290.0000.01215.86
7.1.280.0030.00615.70
7.1.270.0040.00915.65
7.1.260.0060.00315.76
7.1.250.0060.00915.59
7.1.240.0080.00515.65
7.1.230.0100.00015.88
7.1.220.0040.01115.78
7.1.210.0030.00715.57
7.1.200.0020.00915.85
7.1.190.0060.00315.61
7.1.180.0000.00815.78
7.1.170.0050.00315.72
7.1.160.0070.00715.87
7.1.150.0060.00615.71
7.1.140.0000.01115.87
7.1.130.0060.00615.92
7.1.120.0000.00915.69
7.1.110.0070.00315.93
7.1.100.0250.00715.90
7.1.90.0070.00315.82
7.1.80.0000.01315.98
7.1.70.0000.00816.66
7.1.60.0030.00917.56
7.1.50.0090.00816.42
7.1.40.0040.01215.69
7.1.30.0030.00916.00
7.1.20.0060.00615.82
7.1.10.0030.01015.39
7.1.00.0050.04218.98
7.0.330.0040.00715.23
7.0.320.0000.01015.38
7.0.310.0080.00015.34
7.0.300.0070.00015.45
7.0.290.0070.00315.36
7.0.280.0090.00015.46
7.0.270.0060.00615.31
7.0.260.0030.00615.18
7.0.250.0060.00615.64
7.0.240.0070.00415.36
7.0.230.0050.00515.64
7.0.220.0040.00415.55
7.0.210.0000.00815.27
7.0.200.0020.00716.20
7.0.190.0040.00715.31
7.0.180.0070.00315.18
7.0.170.0060.00315.51
7.0.160.0000.01215.56
7.0.150.0040.00715.34
7.0.140.0030.04118.71
7.0.130.0000.01015.46
7.0.120.0070.00715.39
7.0.110.0080.00415.50
7.0.100.0100.00015.35
7.0.90.0000.01115.32
7.0.80.0070.00715.42
7.0.70.0060.00615.48
7.0.60.0050.04117.59
7.0.50.0080.02516.67
7.0.40.0120.04316.87
7.0.30.0150.04416.73
7.0.20.0140.03016.75
7.0.10.0080.04416.77
7.0.00.0050.04316.80
5.6.380.0060.00614.37
5.6.370.0070.00314.38
5.6.360.0060.00914.31
5.6.350.0000.01414.60
5.6.340.0060.00614.15
5.6.330.0080.00414.53
5.6.320.0000.00814.36
5.6.310.0060.00614.19
5.6.300.0030.01014.45
5.6.290.0060.00614.19
5.6.280.0050.03917.59
5.6.270.0030.01014.11
5.6.260.0100.00314.36
5.6.250.0050.00514.23
5.6.240.0030.00714.46
5.6.230.0120.00414.17
5.6.220.0090.00014.08
5.6.210.0070.04517.48
5.6.200.0020.03016.12
5.6.190.0070.04317.42
5.6.180.0160.02517.58
5.6.170.0170.04717.49
5.6.160.0100.02517.31
5.6.150.0110.03616.13
5.6.140.0140.03816.38
5.6.130.0050.04616.16
5.6.120.0080.02717.72
5.6.110.0150.03717.59
5.6.100.0030.04817.87
5.6.90.0090.04017.59
5.6.80.0080.04517.43
5.6.70.2180.02517.40
5.6.60.0080.00414.19
5.6.50.0040.00814.04
5.6.40.0060.00613.95
5.6.30.0000.01014.14
5.6.20.0040.01114.02
5.6.10.0070.00714.28
5.6.00.0030.00614.13
5.5.380.0060.00611.06
5.5.370.0060.00010.91
5.5.360.0000.00611.27
5.5.350.0080.04615.76
5.5.340.0060.03614.46
5.5.330.0100.03615.82
5.5.320.0120.02315.81
5.5.310.0120.02315.70
5.5.300.0030.03014.58
5.5.290.0070.04214.60
5.5.280.0070.02216.02
5.5.270.0030.04816.02
5.5.260.0090.04116.13
5.5.250.0030.03515.97
5.5.240.0120.03015.77
5.5.230.0080.00311.20
5.5.220.0040.00711.22
5.5.210.0040.00411.02
5.5.200.0070.00411.35
5.5.190.0000.00810.90
5.5.180.0040.00411.34
5.5.170.0070.00011.03
5.5.160.0060.00011.20
5.5.150.0030.00311.22
5.5.140.0040.00411.05
5.5.130.0040.00411.29
5.5.120.0040.00411.24
5.5.110.0050.00510.95
5.5.100.0040.00811.04
5.5.90.0000.00711.08
5.5.80.0000.01011.12
5.5.70.0030.00611.18
5.5.60.0040.00411.02
5.5.50.0040.00411.23
5.5.40.0040.00411.26
5.5.30.0040.00410.98
5.5.20.0000.01010.90
5.5.10.0060.00310.91
5.5.00.0080.00011.05
5.4.450.0350.02715.14
5.4.440.0360.02615.39
5.4.430.0530.03515.26
5.4.420.0370.00215.36
5.4.410.0340.00215.28
5.4.400.0320.00415.06
5.4.390.0380.00114.98
5.4.380.0430.00615.22
5.4.370.0350.00315.05
5.4.360.0320.00515.11
5.4.350.0450.00215.09
5.4.340.0050.02311.52
5.4.330.0100.00010.96
5.4.320.0040.02111.79
5.4.310.0040.02511.83
5.4.300.0070.01911.74
5.4.290.0040.02211.82
5.4.280.0060.01711.65
5.4.270.0090.01811.72
5.4.260.0020.02411.75
5.4.250.0050.02111.65
5.4.240.0060.02011.65
5.4.230.0060.02011.71
5.4.220.0050.01911.65
5.4.210.0030.02111.70
5.4.200.0050.02811.64
5.4.190.0030.02211.67
5.4.180.0060.02111.72
5.4.170.0060.02211.65
5.4.160.0060.02011.64
5.4.150.0040.02411.68
5.4.140.0080.02311.49
5.4.130.0100.02911.58
5.4.120.0070.02711.47
5.4.110.0070.03311.47
5.4.100.0040.02511.45
5.4.90.0080.02211.53
5.4.80.0080.02111.50
5.4.70.0050.02211.51
5.4.60.0060.02211.62
5.4.50.0060.02211.48
5.4.40.0040.02411.45
5.4.30.0060.02611.51
5.4.20.0070.02711.45
5.4.10.0040.02311.49
5.4.00.0040.02111.19
5.3.290.0080.02511.85
5.3.280.0060.02411.80
5.3.270.0090.02611.81
5.3.260.0100.02711.81
5.3.250.0070.02911.81
5.3.240.0090.02911.81
5.3.230.0090.02311.80
5.3.220.0040.02311.79
5.3.210.0080.02711.79
5.3.200.0110.02111.79
5.3.190.0050.02211.79
5.3.180.0060.02111.79
5.3.170.0020.02311.79
5.3.160.0100.02111.79
5.3.150.0050.02711.79
5.3.140.0030.02411.78
5.3.130.0050.02411.78
5.3.120.0040.02511.78
5.3.110.0070.02611.78
5.3.100.0080.01911.51
5.3.90.0050.02411.50
5.3.80.0030.02211.50
5.3.70.0070.02211.50
5.3.60.0050.02011.49
5.3.50.0040.02111.46
5.3.40.0070.02011.46
5.3.30.0060.01911.44
5.3.20.0040.02011.33
5.3.10.0050.01911.31
5.3.00.0060.02211.31
5.2.170.0030.02510.05
5.2.160.0040.01710.05
5.2.150.0060.01610.05
5.2.140.0040.01710.05
5.2.130.0070.01410.03
5.2.120.0040.01510.03
5.2.110.0020.01910.04
5.2.100.0050.01510.04
5.2.90.0030.01910.04
5.2.80.0050.01810.03
5.2.70.0020.02010.03
5.2.60.0080.01510.01
5.2.50.0040.01910.00
5.2.40.0040.0189.99
5.2.30.0040.0179.97
5.2.20.0040.0169.96
5.2.10.0060.0159.92
5.2.00.0020.0209.85
5.1.60.0020.0159.49
5.1.50.0060.0129.49
5.1.40.0050.0129.48
5.1.30.0020.0169.66
5.1.20.0040.0159.67
5.1.10.0050.0159.53
5.1.00.0050.0209.53
5.0.50.0060.0158.77
5.0.40.0040.0108.70
5.0.30.0020.0188.60
5.0.20.0050.0128.59
5.0.10.0020.0158.58
5.0.00.0020.0208.58
4.4.90.0020.0167.84
4.4.80.0020.0137.83
4.4.70.0060.0117.83
4.4.60.0010.0127.83
4.4.50.0020.0147.83
4.4.40.0040.0247.80
4.4.30.0050.0117.83
4.4.20.0030.0147.87
4.4.10.0040.0127.87
4.4.00.0020.0197.83
4.3.110.0020.0137.79
4.3.100.0050.0107.78
4.3.90.0020.0137.77
4.3.80.0050.0147.74
4.3.70.0060.0157.77
4.3.60.0020.0097.76
4.3.50.0040.0107.76
4.3.40.0040.0307.71
4.3.30.0020.0137.10
4.3.20.0020.0127.09
4.3.10.0010.0117.07
4.3.00.0070.0158.77

preferences:
46.93 ms | 401 KiB | 5 Q