3v4l.org

run code in 300+ PHP versions simultaneously
<?php $exp = '/[\s\S]*\{%[\s\S]*for[\s\S]*ad[\s\S]*in[\s\S]*ads[\s\S]*%\}/'; $string = "{% for ad in ads %} sdfksjf {% for ad in ads %} sdfksjf2 {% for ad in ads %} sdfksjf3"; /* function str_lreplace($search, $replace, $subject) { return preg_replace('~(.*)' . preg_quote($search, '~') . '~', '$1' . $replace, $subject, 1); } echo str_lreplace($exp,'',$string); */ $end_loop_regex = '/[\.\s\S]*\{%[\s\S]*endfor[\s\S]*%\}/'; $endfor_str = "{% endfor%}1 {% endfor %}2 {%endfor%}3 {% endfor%}4"; $arr = preg_grep($end_loop_regex,$endfor_str,PREG_SPLIT_OFFSET_CAPTURE); print_r($arr); //$last_end_for_pos = strrpos($return,'{% endfor %}'); //$return = substr($return,0,$last_end_for_pos);

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.0120.00816.73
8.3.50.0080.00821.21
8.3.40.0070.01118.67
8.3.30.0070.01019.18
8.3.20.0040.00420.30
8.3.10.0030.00623.52
8.3.00.0030.00619.38
8.2.180.0100.01018.29
8.2.170.0090.00622.96
8.2.160.0110.00420.15
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0030.01426.16
8.2.120.0070.00022.16
8.2.110.0100.01022.10
8.2.100.0110.00017.78
8.2.90.0040.00419.18
8.2.80.0050.00318.05
8.2.70.0030.00617.50
8.2.60.0030.00717.80
8.2.50.0060.00318.07
8.2.40.0040.00419.88
8.2.30.0040.00419.66
8.2.20.0050.00217.73
8.2.10.0040.00418.11
8.2.00.0070.00317.65
8.1.280.0120.00825.92
8.1.270.0040.00423.93
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0130.00723.54
8.1.230.0040.00719.09
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0080.00017.53
8.1.180.0000.00919.01
8.1.170.0030.00718.52
8.1.160.0040.00422.00
8.1.150.0000.00718.51
8.1.140.0040.00417.45
8.1.130.0050.00217.90
8.1.120.0000.00717.32
8.1.110.0030.00517.45
8.1.100.0070.00017.33
8.1.90.0000.00717.30
8.1.80.0000.00817.38
8.1.70.0030.00317.32
8.1.60.0000.00817.58
8.1.50.0040.00417.52
8.1.40.0030.00617.56
8.1.30.0080.00017.58
8.1.20.0030.00517.64
8.1.10.0040.00417.59
8.1.00.0000.00717.41
8.0.300.0040.00419.21
8.0.290.0000.01017.04
8.0.280.0030.00318.29
8.0.270.0030.00317.20
8.0.260.0030.00317.21
8.0.250.0030.00316.95
8.0.240.0000.00816.96
8.0.230.0000.00816.98
8.0.220.0000.00716.88
8.0.210.0090.00016.91
8.0.200.0030.00316.98
8.0.190.0000.00816.96
8.0.180.0040.00416.81
8.0.170.0030.00516.91
8.0.160.0040.00416.99
8.0.150.0040.00416.83
8.0.140.0050.00316.80
8.0.130.0040.00413.34
8.0.120.0050.00316.84
8.0.110.0040.00416.78
8.0.100.0000.00716.75
8.0.90.0050.00316.79
8.0.80.0060.00916.95
8.0.70.0040.00416.89
8.0.60.0000.00716.86
8.0.50.0070.00017.01
8.0.30.0110.00716.91
8.0.20.0140.00717.40
8.0.10.0000.00716.98
8.0.00.0110.00816.69
7.4.330.0050.00015.04
7.4.320.0000.00616.44
7.4.300.0060.00016.53
7.4.290.0080.00316.45
7.4.280.0000.00916.45
7.4.270.0070.00016.41
7.4.260.0000.00716.42
7.4.250.0060.00316.53
7.4.240.0000.00716.50
7.4.230.0040.00416.38
7.4.220.0110.00716.62
7.4.210.0070.00616.60
7.4.200.0040.00416.24
7.4.190.0030.00316.39
7.4.160.0150.00316.21
7.4.150.0130.00617.40
7.4.140.0110.00817.86
7.4.130.0110.00516.51
7.4.120.0080.00816.45
7.4.110.0070.01016.38
7.4.100.0120.00616.57
7.4.90.0110.00616.32
7.4.80.0130.00319.39
7.4.70.0060.00916.46
7.4.60.0140.00316.27
7.4.50.0030.00616.46
7.4.40.0060.01022.77
7.4.30.0160.00616.42
7.4.10.0040.01416.00
7.4.00.0100.00715.38
7.3.330.0050.00012.88
7.3.320.0000.00513.05
7.3.310.0050.00216.27
7.3.300.0030.00316.22
7.3.290.0090.00916.18
7.3.280.0100.00716.23
7.3.270.0080.00817.40
7.3.260.0100.00716.34
7.3.250.0110.00616.19
7.3.240.0090.00916.43
7.3.230.0090.00616.39
7.3.210.0000.01616.17
7.3.200.0060.01519.39
7.3.190.0080.00916.24
7.3.180.0070.01016.24
7.3.170.0110.00616.29
7.3.160.0080.00816.27
7.3.130.0030.01116.00
7.3.120.0050.01215.44
7.3.110.0070.00915.35
7.3.100.0070.00915.35
7.3.90.0020.01215.48
7.3.80.0080.00815.23
7.3.70.0070.00415.37
7.3.60.0030.01015.35
7.3.50.0090.00515.35
7.3.40.0060.01015.26
7.3.30.0060.01015.34
7.3.20.0030.01216.52
7.3.10.0050.01116.32
7.3.00.0090.00516.42
7.2.330.0070.01016.63
7.2.320.0030.02016.63
7.2.310.0060.01016.13
7.2.300.0120.00616.55
7.2.290.0120.00416.39
7.2.260.0030.01616.00
7.2.250.0070.01116.00
7.2.240.0030.00915.39
7.2.230.0030.01315.58
7.2.220.0100.00815.28
7.2.210.0090.00915.41
7.2.200.0080.00615.38
7.2.190.0070.01015.35
7.2.180.0060.01015.52
7.2.170.0040.00915.36
7.2.160.0080.00615.38
7.2.150.0130.00416.63
7.2.140.0050.01116.77
7.2.130.0080.00416.70
7.2.120.0100.00516.57
7.2.110.0060.00816.63
7.2.100.0060.01016.73
7.2.90.0060.00916.79
7.2.80.0100.00716.70
7.2.70.0060.00616.59
7.2.60.0030.01016.86
7.2.50.0070.00516.65
7.2.40.0050.00816.69
7.2.30.0040.00716.79
7.2.20.0050.00616.83
7.2.10.0080.00816.81
7.2.00.0070.00616.69
7.1.330.0060.00915.88
7.1.320.0050.00915.79
7.1.310.0060.00915.79
7.1.300.0080.00515.89
7.1.290.0070.00915.72
7.1.280.0030.00815.72
7.1.270.0060.00915.87
7.1.260.0040.01015.92
7.1.250.0080.00515.78
7.1.240.0140.00016.00
7.1.230.0040.00716.00
7.1.220.0060.00616.00
7.1.210.0070.00716.00
7.1.200.0030.00915.89
7.1.190.0060.00816.00
7.1.180.0050.00316.00
7.1.170.0040.00816.00
7.1.160.0060.00316.00
7.1.150.0030.00916.00
7.1.140.0070.00316.00
7.1.130.0030.01016.00
7.1.120.0040.00816.00
7.1.110.0030.01016.00
7.1.100.0000.01516.00
7.1.90.0030.00616.00
7.1.80.0000.01616.00
7.1.70.0160.00316.53
7.1.60.0050.00917.73
7.1.50.0060.01116.43
7.1.40.0030.01116.00
7.1.30.0070.00716.00
7.1.20.0150.00016.00
7.1.10.0100.00616.00
7.1.00.0050.04219.18
7.0.330.0030.00716.00
7.0.320.0040.00416.00
7.0.310.0040.00916.00
7.0.300.0040.01116.00
7.0.290.0000.00816.00
7.0.280.0030.01016.00
7.0.270.0030.00916.00
7.0.260.0070.00716.00
7.0.250.0090.00616.00
7.0.240.0100.00716.00
7.0.230.0060.00616.00
7.0.220.0040.00416.00
7.0.210.0100.00616.00
7.0.200.0040.00416.24
7.0.190.0060.00316.00
7.0.180.0030.01016.00
7.0.170.0070.00316.00
7.0.160.0040.01116.00
7.0.150.0060.00616.00
7.0.140.0020.04419.02
7.0.130.0030.00916.00
7.0.120.0080.00016.00
7.0.110.0000.01616.00
7.0.100.0030.01316.00
7.0.90.0070.01016.00
7.0.80.0070.00716.00
7.0.70.0030.00916.00
7.0.60.0050.02518.03
7.0.50.0040.04016.88
7.0.40.0070.04618.01
7.0.30.0150.03218.09
7.0.20.0150.04718.11
7.0.10.0070.02918.15
7.0.00.0050.02418.09
5.6.400.0090.00616.00
5.6.390.0070.00316.00
5.6.380.0040.00416.00
5.6.370.0100.00316.00
5.6.360.0100.00316.00
5.6.350.0060.00316.00
5.6.340.0080.00616.00
5.6.330.0030.00616.00
5.6.320.0000.01516.00
5.6.310.0070.00416.00
5.6.300.0030.00716.00
5.6.290.0060.00316.00
5.6.280.0030.04218.56
5.6.270.0100.00716.00
5.6.260.0100.00716.00
5.6.250.0070.00716.00
5.6.240.0000.01016.00
5.6.230.0160.00016.00
5.6.220.0070.00716.00
5.6.210.0080.03818.23
5.6.200.0050.04117.08
5.6.190.0050.04818.20
5.6.180.0100.04918.30
5.6.170.0200.03018.25
5.6.160.0070.04118.24
5.6.150.0100.03017.11
5.6.140.0070.04317.10
5.6.130.0080.02117.07
5.6.120.0090.04018.50
5.6.110.0030.04718.50
5.6.100.0050.04018.54
5.6.90.0050.03118.54
5.6.80.0030.02718.19
5.6.70.2000.02318.17
5.6.60.0000.01316.00
5.6.50.0090.00616.00
5.6.40.0040.01116.00
5.6.30.0140.00016.00
5.6.20.0070.00716.00
5.6.10.0030.01016.00
5.6.00.0070.00716.00
5.5.380.0000.01216.00
5.5.370.0030.00716.00
5.5.360.0030.00916.00
5.5.350.0120.03418.26
5.5.340.0050.04716.98
5.5.330.0050.04318.05
5.5.320.0160.02818.15
5.5.310.0200.04518.14
5.5.300.0080.03016.96
5.5.290.0070.03216.95
5.5.280.0060.02418.43
5.5.270.0030.04818.43
5.5.260.0120.04318.46
5.5.250.0080.04518.22
5.5.240.0150.03318.07
5.5.230.0080.00416.00
5.5.220.0040.00816.00
5.5.210.0070.00416.00
5.5.200.0100.00316.00
5.5.190.0040.01216.00
5.5.180.0140.00016.00
5.5.170.0030.00616.00
5.5.160.0070.00716.00
5.5.150.0110.00416.00
5.5.140.0030.01216.00
5.5.130.0060.00616.00
5.5.120.0050.00516.00
5.5.110.0030.00916.00
5.5.100.0000.01116.00
5.5.90.0060.00616.00
5.5.80.0000.01516.00
5.5.70.0070.00716.00
5.5.60.0000.01216.00
5.5.50.0040.01116.00
5.5.40.0040.00816.00
5.5.30.0090.00016.00
5.5.20.0090.00616.00
5.5.10.0080.00416.00
5.5.00.0090.00616.00
5.4.450.0350.03417.72
5.4.440.0400.03917.79
5.4.430.0100.02717.73
5.4.420.0390.03017.72
5.4.410.0310.03117.67
5.4.400.0400.03417.40
5.4.390.0330.03317.56
5.4.380.0200.03217.25
5.4.370.0230.02517.26
5.4.360.0180.03017.37
5.4.350.0130.03217.29
5.4.340.0220.02817.31
5.4.330.0070.00316.00
5.4.320.0010.02314.22
5.4.310.0040.02214.22
5.4.300.0060.02114.22
5.4.290.0160.06914.21
5.4.280.0060.04414.16
5.4.270.0110.03414.16
5.4.260.0130.05214.16
5.4.250.0080.02614.16
5.4.240.0070.02914.16
5.4.230.0070.03414.16
5.4.220.0080.02714.16
5.4.210.0060.02814.16
5.4.200.0060.03114.16
5.4.190.0090.02714.16
5.4.180.0050.03014.16
5.4.170.0040.03114.16
5.4.160.0110.03914.16
5.4.150.0090.02714.16
5.4.140.0080.03214.00
5.4.130.0080.03114.00
5.4.120.0070.03913.97
5.4.110.0080.02613.97
5.4.100.0060.03313.97
5.4.90.0080.03713.97
5.4.80.0040.02513.97
5.4.70.0070.02513.97
5.4.60.0070.03013.97
5.4.50.0080.02313.97
5.4.40.0070.04213.96
5.4.30.0090.02913.96
5.4.20.0080.05213.96
5.4.10.0040.04913.96
5.4.00.0120.04213.71
5.3.290.0020.02514.40
5.3.280.0060.02814.35
5.3.270.0070.03014.36
5.3.260.0090.03214.36
5.3.250.0050.02814.36
5.3.240.0090.03914.36
5.3.230.0090.03514.35
5.3.220.0110.04514.34
5.3.210.0060.03614.34
5.3.200.0090.04114.34
5.3.190.0150.04814.34
5.3.180.0100.04514.34
5.3.170.0100.03314.33
5.3.160.0120.04314.33
5.3.150.0160.04614.33
5.3.140.0120.03414.33
5.3.130.0130.05914.33
5.3.120.0090.02514.33
5.3.110.0090.03314.33
5.3.100.0050.03614.06
5.3.90.0050.02214.04
5.3.80.0110.02514.04
5.3.70.0060.02514.03
5.3.60.0070.02414.03
5.3.50.0060.02314.00
5.3.40.0070.03114.00
5.3.30.0100.04113.97
5.3.20.0090.03713.86
5.3.10.0060.03113.84
5.3.00.0050.02813.84
5.2.170.0090.0419.18
5.2.160.0140.0709.18
5.2.150.0090.0409.18
5.2.140.0070.0429.17
5.2.130.0070.0409.14
5.2.120.0060.0459.14
5.2.110.0130.0399.14
5.2.100.0150.0709.14
5.2.90.0090.0619.14
5.2.80.0060.0569.13
5.2.70.0100.0409.13
5.2.60.0090.0379.09
5.2.50.0090.0439.05
5.2.40.0050.0469.03
5.2.30.0060.0479.01
5.2.20.0120.0389.00
5.2.10.0130.0508.92
5.2.00.0060.0458.78
5.1.60.0160.0458.06
5.1.50.0110.0778.06
5.1.40.0050.0388.04
5.1.30.0060.0418.39
5.1.20.0120.0598.41
5.1.10.0060.0458.13
5.1.00.0060.0398.14
5.0.50.0090.0536.61
5.0.40.0200.0426.47
5.0.30.0090.0546.29
5.0.20.0080.0336.26
5.0.10.0050.0216.24
5.0.00.0010.0376.23
4.4.90.0050.0164.78
4.4.80.0060.0154.75
4.4.70.0050.0184.75
4.4.60.0120.0394.76
4.4.50.0100.0334.77
4.4.40.0090.0554.71
4.4.30.0000.0484.76
4.4.20.0120.0404.84
4.4.10.0090.0464.85
4.4.00.0050.0504.75
4.3.110.0050.0224.67
4.3.100.0040.0214.67
4.3.90.0060.0264.63
4.3.80.0050.0364.58
4.3.70.0090.0244.63
4.3.60.0060.0414.63
4.3.50.0030.0404.62
4.3.40.0080.0464.54
4.3.30.0040.0293.28
4.3.20.0070.0343.26
4.3.10.0050.0313.22
4.3.00.0130.03010.54

preferences:
47 ms | 401 KiB | 5 Q