3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isCorrect($string) { $len = strlen($string); $stack = []; for( $i = 0; $i < $len; ++$i) { if ($string[$i] == '(') array_push($stack, $string[$i]); else if($string[$i] == ')') { if ( empty($stack) === false) array_pop($stack); else return false; } } return empty($stack); } $string = '((()))'; 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.0180.00018.28
8.3.50.0290.00621.15
8.3.40.0080.00618.79
8.3.30.0070.00719.09
8.3.20.0070.00020.33
8.3.10.0080.00023.61
8.3.00.0000.00819.13
8.2.180.0160.00616.38
8.2.170.0100.00322.96
8.2.160.0040.01420.48
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0110.00722.25
8.2.110.0040.00422.11
8.2.100.0000.01117.63
8.2.90.0040.00419.22
8.2.80.0080.00017.97
8.2.70.0040.00417.25
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0060.00319.88
8.2.30.0000.01117.97
8.2.20.0050.00317.76
8.2.10.0090.00018.02
8.2.00.0050.00217.60
8.1.280.0070.00725.92
8.1.270.0050.00323.97
8.1.260.0030.00626.35
8.1.250.0000.00728.09
8.1.240.0070.00417.48
8.1.230.0040.00717.48
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0030.00617.11
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0040.00418.62
8.1.160.0030.00321.95
8.1.150.0000.00718.84
8.1.140.0000.00717.44
8.1.130.0030.00317.74
8.1.120.0000.00717.36
8.1.110.0080.00017.41
8.1.100.0000.00717.47
8.1.90.0040.00417.50
8.1.80.0030.00517.38
8.1.70.0000.00717.33
8.1.60.0040.00417.46
8.1.50.0090.00017.47
8.1.40.0000.00817.41
8.1.30.0030.00617.55
8.1.20.0030.00517.54
8.1.10.0040.00417.47
8.1.00.0000.00717.57
8.0.300.0080.00418.77
8.0.290.0040.00416.63
8.0.280.0040.00418.40
8.0.270.0030.00317.30
8.0.260.0030.00317.12
8.0.250.0000.00716.92
8.0.240.0000.00816.76
8.0.230.0040.00416.87
8.0.220.0030.00316.86
8.0.210.0000.00616.87
8.0.200.0070.00016.77
8.0.190.0040.00416.90
8.0.180.0000.00716.78
8.0.170.0040.00416.86
8.0.160.0000.00716.86
8.0.150.0000.00816.72
8.0.140.0000.00716.75
8.0.130.0000.00513.23
8.0.120.0040.00416.75
8.0.110.0000.00716.96
8.0.100.0070.00016.78
8.0.90.0050.00316.95
8.0.80.0060.01216.99
8.0.70.0000.00816.79
8.0.60.0040.00417.01
8.0.50.0000.00716.99
8.0.30.0090.01017.19
8.0.20.0140.01117.40
8.0.10.0070.00016.86
8.0.00.0090.00816.91
7.4.330.0000.00515.02
7.4.320.0070.00016.39
7.4.300.0030.00316.50
7.4.290.0030.00316.50
7.4.280.0060.00516.59
7.4.270.0030.00316.45
7.4.260.0000.00716.60
7.4.250.0030.00616.61
7.4.240.0040.00416.51
7.4.230.0040.00416.25
7.4.220.0110.00716.61
7.4.210.0070.01016.51
7.4.200.0070.00016.60
7.4.160.0080.00816.41
7.4.150.0100.01017.40
7.4.140.0070.01217.86
7.4.130.0130.00416.52
7.4.120.0080.00916.36
7.4.110.0150.00616.51
7.4.100.0150.00916.64
7.4.90.0070.01016.39
7.4.80.0060.01119.39
7.4.70.0100.01016.70
7.4.60.0060.01616.64
7.4.50.0070.00016.52
7.4.40.0090.01216.44
7.4.30.0100.00716.59
7.4.00.0090.00715.07
7.3.330.0000.00513.19
7.3.320.0050.00013.43
7.3.310.0030.00316.38
7.3.300.0070.00016.34
7.3.290.0070.00716.32
7.3.280.0070.00816.34
7.3.270.0070.01117.40
7.3.260.0090.00916.73
7.3.250.0090.00716.46
7.3.240.0080.01116.42
7.3.230.0090.01516.39
7.3.210.0040.01116.36
7.3.200.0120.00919.39
7.3.190.0140.00716.28
7.3.180.0060.01316.43
7.3.170.0090.01016.68
7.3.160.0130.00316.30
7.3.120.0050.01314.68
7.3.110.0020.01214.56
7.3.100.0050.00814.72
7.3.90.0040.01214.73
7.3.80.0080.00614.73
7.3.70.0050.00714.74
7.3.60.0030.01214.70
7.3.50.0070.00714.90
7.3.40.0050.01114.82
7.3.30.0030.00914.86
7.3.20.0070.00716.51
7.3.10.0110.00516.59
7.3.00.0090.00516.69
7.2.330.0080.00816.63
7.2.320.0000.02316.77
7.2.310.0150.00316.85
7.2.300.0070.01016.59
7.2.290.0130.00916.53
7.2.250.0040.01214.66
7.2.240.0050.01214.80
7.2.230.0020.01115.09
7.2.220.0080.00815.18
7.2.210.0080.00815.26
7.2.200.0020.01315.09
7.2.190.0050.00815.21
7.2.180.0050.00815.15
7.2.170.0060.00815.13
7.2.160.0100.01014.81
7.2.150.0070.00717.06
7.2.140.0030.00616.74
7.2.130.0070.01017.02
7.2.120.0120.00616.99
7.2.110.0190.00016.71
7.2.100.0030.01716.88
7.2.90.0070.01017.01
7.2.80.0070.01316.84
7.2.70.0120.00616.91
7.2.60.0030.01216.85
7.2.50.0000.01417.07
7.2.40.0030.01017.11
7.2.30.0090.00617.10
7.2.20.0060.00917.13
7.2.10.0070.01016.90
7.2.00.0020.01018.04
7.1.330.0060.00715.78
7.1.320.0070.00315.83
7.1.310.0020.01515.68
7.1.300.0050.00815.59
7.1.290.0110.00615.78
7.1.280.0010.01315.69
7.1.270.0070.00715.82
7.1.260.0050.00815.74
7.1.250.0090.00915.95
7.1.200.0070.00715.59
7.1.100.0030.00917.98
7.1.70.0050.00517.25
7.1.60.0090.00919.11
7.1.50.0130.01016.90
7.1.00.0070.07322.45
7.0.200.0000.01116.93
7.0.140.0000.07721.95
7.0.60.0130.08019.86
7.0.50.0130.05017.91
7.0.40.0100.06720.23
7.0.30.0230.06720.20
7.0.20.0200.04320.14
7.0.10.0130.04720.18
7.0.00.0070.05020.16
5.6.280.0030.07020.89
5.6.210.0130.06320.76
5.6.200.0070.08718.16
5.6.190.0070.08320.60
5.6.180.0270.07720.33
5.6.170.0230.05020.50
5.6.160.0070.09020.55
5.6.150.0030.07718.22
5.6.140.0030.04318.21
5.6.130.0030.08318.19
5.6.120.0000.07320.98
5.6.110.0070.08721.10
5.6.100.0100.06721.00
5.6.90.0130.07720.98
5.6.80.0170.07320.35
5.6.70.4130.02720.28
5.5.350.0070.03720.28
5.5.340.0030.03717.95
5.5.330.0070.04020.40
5.5.320.0230.04020.32
5.5.310.0200.03720.51
5.5.300.0070.08017.95
5.5.290.0000.04718.02
5.5.280.0000.04320.88
5.5.270.0000.04320.79
5.5.260.0230.07020.80
5.5.250.0130.07320.61
5.5.240.0270.07720.16
5.4.450.0100.06019.36
5.4.440.0830.08319.47
5.4.430.0170.04719.47
5.4.420.0670.00019.39
5.4.410.0670.00019.44
5.4.400.0670.00019.02
5.4.390.0630.00019.02
5.4.380.0670.00019.06
5.4.370.0630.00019.04
5.4.360.0600.00019.02
5.4.350.0670.00019.13
5.4.340.0060.03712.02
5.4.320.0040.03912.50
5.4.310.0070.04412.50
5.4.300.0080.03312.50
5.4.290.0060.03712.50
5.4.280.0070.03312.39
5.4.270.0030.03912.40
5.4.260.0040.03912.40
5.4.250.0040.03812.39
5.4.240.0110.03512.40
5.4.230.0060.04712.39
5.4.220.0050.03612.39
5.4.210.0040.03812.39
5.4.200.0080.03512.39
5.4.190.0100.03712.39
5.4.180.0070.03512.38
5.4.170.0050.03712.39
5.4.160.0050.03812.39
5.4.150.0060.03512.39
5.4.140.0060.03612.07
5.4.130.0050.03512.06
5.4.120.0070.04512.02
5.4.110.0080.03312.01
5.4.100.0070.03312.01
5.4.90.0050.03712.01
5.4.80.0060.03612.01
5.4.70.0050.03512.01
5.4.60.0090.03112.01
5.4.50.0070.03612.01
5.4.40.0060.03512.00
5.4.30.0040.03711.99
5.4.20.0030.03811.99
5.4.10.0080.03711.99
5.4.00.0040.04011.48
5.3.290.0040.04112.80
5.3.280.0010.04212.71
5.3.270.0060.03812.73
5.3.260.0090.03612.72
5.3.250.0070.03712.72
5.3.240.0040.04012.72
5.3.230.0040.04112.71
5.3.220.0030.04112.68
5.3.210.0070.03912.68
5.3.200.0040.04112.68
5.3.190.0060.03812.68
5.3.180.0080.04312.67
5.3.170.0040.03912.67
5.3.160.0070.03612.67
5.3.150.0040.04012.67
5.3.140.0100.03412.66
5.3.130.0060.03912.66
5.3.120.0050.04012.66
5.3.110.0070.03912.65
5.3.100.0090.03912.13
5.3.90.0040.05012.11
5.3.80.0040.04512.09
5.3.70.0080.04012.09
5.3.60.0100.04312.09
5.3.50.0060.04012.02
5.3.40.0080.04512.02
5.3.30.0060.03511.98
5.3.20.0050.03611.77
5.3.10.0070.03711.74
5.3.00.0050.03911.72
5.2.170.0070.0339.21
5.2.160.0050.0299.21
5.2.150.0040.0329.21
5.2.140.0060.0319.21
5.2.130.0080.0259.18
5.2.120.0050.0289.18
5.2.110.0050.0319.18
5.2.100.0030.0299.18
5.2.90.0050.0339.18
5.2.80.0040.0359.18
5.2.70.0050.0319.18
5.2.60.0030.0329.13
5.2.50.0070.0299.09
5.2.40.0070.0289.07
5.2.30.0070.0299.05
5.2.20.0040.0309.04
5.2.10.0090.0238.95
5.2.00.0050.0288.81
5.1.60.0040.0258.09
5.1.50.0020.0268.08
5.1.40.0050.0258.07
5.1.30.0050.0318.42
5.1.20.0030.0308.44
5.1.10.0040.0258.16
5.1.00.0030.0268.16
5.0.50.0050.0196.64
5.0.40.0050.0186.51
5.0.30.0020.0416.31
5.0.20.0050.0186.29
5.0.10.0050.0196.27
5.0.00.0020.0326.26
4.4.90.0040.0164.78
4.4.80.0040.0184.75
4.4.70.0030.0174.75
4.4.60.0040.0164.75
4.4.50.0030.0154.77
4.4.40.0030.0244.71
4.4.30.0020.0154.76
4.4.20.0030.0154.85
4.4.10.0030.0154.84
4.4.00.0020.0254.76
4.3.110.0020.0164.67
4.3.100.0040.0134.66
4.3.90.0030.0204.63
4.3.80.0030.0244.59
4.3.70.0030.0144.63
4.3.60.0020.0164.63
4.3.50.0010.0164.63
4.3.40.0040.0264.54
4.3.30.0030.0143.30
4.3.20.0020.0213.27
4.3.10.0020.0213.24
4.3.00.0030.0236.64

preferences:
49.46 ms | 401 KiB | 5 Q