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_split($end_loop_regex,$endfor_str,0,PREG_SPLIT_OFFSET_CAPTURE); preg_match_all($end_loop_regex,$endfor_str,$arr,PREG_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.0140.00016.63
8.3.50.0090.00621.29
8.3.40.0150.00618.84
8.3.30.0060.00919.06
8.3.20.0040.00420.34
8.3.10.0040.00423.53
8.3.00.0090.00019.38
8.2.180.0070.01418.29
8.2.170.0120.00322.96
8.2.160.0140.00420.52
8.2.150.0070.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00022.26
8.2.110.0040.00422.16
8.2.100.0120.00017.91
8.2.90.0030.00519.22
8.2.80.0060.00317.97
8.2.70.0060.00317.63
8.2.60.0050.00317.80
8.2.50.0000.00818.07
8.2.40.0030.00520.00
8.2.30.0000.00819.94
8.2.20.0020.00517.74
8.2.10.0050.00218.04
8.2.00.0030.00717.76
8.1.280.0150.00625.92
8.1.270.0040.00424.00
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0090.00023.96
8.1.230.0070.00319.20
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.38
8.1.190.0040.00417.30
8.1.180.0000.01118.10
8.1.170.0030.00618.62
8.1.160.0030.00621.97
8.1.150.0000.00718.74
8.1.140.0040.00417.45
8.1.130.0030.00317.86
8.1.120.0000.00717.48
8.1.110.0000.00817.45
8.1.100.0030.00517.43
8.1.90.0000.00717.45
8.1.80.0040.00417.59
8.1.70.0030.00317.41
8.1.60.0060.00317.67
8.1.50.0000.00817.45
8.1.40.0080.00017.61
8.1.30.0000.00817.71
8.1.20.0040.00417.72
8.1.10.0030.00617.71
8.1.00.0080.00017.52
8.0.300.0050.00218.77
8.0.290.0070.00017.05
8.0.280.0030.00518.39
8.0.270.0070.00017.13
8.0.260.0000.00617.26
8.0.250.0000.00717.02
8.0.240.0030.00316.97
8.0.230.0040.00416.95
8.0.220.0000.00717.00
8.0.210.0030.00717.03
8.0.200.0000.00717.04
8.0.190.0040.00417.05
8.0.180.0040.00417.00
8.0.170.0040.00417.02
8.0.160.0030.00516.98
8.0.150.0080.00016.92
8.0.140.0000.00716.98
8.0.130.0040.00413.41
8.0.120.0040.00416.93
8.0.110.0070.00017.03
8.0.100.0070.00016.97
8.0.90.0050.00216.80
8.0.80.0090.00616.95
8.0.70.0040.00417.04
8.0.60.0080.00016.93
8.0.50.0050.00317.09
8.0.30.0070.01317.25
8.0.20.0160.00317.40
8.0.10.0000.00716.88
8.0.00.0150.00416.81
7.4.330.0020.00215.06
7.4.320.0000.00716.61
7.4.300.0030.00316.76
7.4.290.0070.00316.59
7.4.280.0000.00916.71
7.4.270.0030.00316.79
7.4.260.0070.00016.64
7.4.250.0000.00816.61
7.4.240.0040.00316.64
7.4.230.0030.00316.72
7.4.220.0040.01416.68
7.4.210.0030.01316.74
7.4.200.0000.00716.73
7.4.190.0030.00316.71
7.4.160.0060.00916.52
7.4.150.0100.01017.40
7.4.140.0090.00817.86
7.4.130.0090.00816.57
7.4.120.0050.01216.68
7.4.110.0070.01016.63
7.4.100.0070.01416.68
7.4.90.0130.00416.62
7.4.80.0100.00719.39
7.4.70.0030.01316.74
7.4.60.0100.00716.55
7.4.50.0040.00416.70
7.4.40.0030.00922.77
7.4.30.0000.01616.61
7.4.00.0030.01015.24
7.3.330.0030.00313.04
7.3.320.0050.00013.19
7.3.310.0040.00416.34
7.3.300.0030.00316.32
7.3.290.0000.01516.29
7.3.280.0080.00816.31
7.3.270.0110.00717.40
7.3.260.0120.00616.30
7.3.250.0110.00616.44
7.3.240.0070.01116.64
7.3.230.0060.01216.47
7.3.210.0110.00616.33
7.3.200.0110.00719.39
7.3.190.0060.01016.67
7.3.180.0060.00916.20
7.3.170.0130.00316.71
7.3.160.0120.00416.27
7.3.120.0130.00314.75
7.3.10.0090.00616.79
7.3.00.0060.00616.68
7.2.330.0090.00916.65
7.2.320.0100.01316.51
7.2.310.0100.00716.72
7.2.300.0100.00616.63
7.2.290.0110.00516.52
7.2.130.0140.00016.77
7.2.120.0110.00316.91
7.2.110.0030.01016.89
7.2.100.0000.01116.73
7.2.90.0070.00717.16
7.2.80.0030.01016.88
7.2.70.0120.00016.68
7.2.60.0100.00516.81
7.2.50.0050.00316.83
7.2.40.0080.00816.94
7.2.30.0040.00717.11
7.2.20.0090.00316.94
7.2.10.0000.00816.73
7.2.00.0050.00718.23
7.1.250.0060.00615.91
7.1.200.0070.00315.99
7.1.100.0030.00918.26
7.1.70.0000.01617.34
7.1.60.0090.00619.46
7.1.50.0090.00917.10
7.1.00.0030.07722.47
7.0.200.0050.00216.78
7.0.140.0070.07021.95
7.0.60.0270.07319.92
7.0.50.0030.05718.00
7.0.40.0030.08020.13
7.0.30.0300.06320.12
7.0.20.0300.08020.22
7.0.10.0030.09020.25
7.0.00.0070.04320.05
5.6.280.0030.07321.06
5.6.210.0130.07720.46
5.6.200.0130.07718.16
5.6.190.0100.08320.63
5.6.180.0230.08020.47
5.6.170.0200.08020.39
5.6.160.0130.08320.46
5.6.150.0200.05018.20
5.6.140.0000.06018.14
5.6.130.0030.07018.28
5.6.120.0070.08720.98
5.6.110.0030.05721.10
5.6.100.0070.05321.08
5.6.90.0170.08020.96
5.6.80.0200.06720.36
5.5.350.0200.06720.43
5.5.340.0100.03718.00
5.5.330.0070.04020.57
5.5.320.0330.04720.34
5.5.310.0370.07320.33
5.5.300.0030.07318.03
5.5.290.0030.04018.06
5.5.280.0000.04320.73
5.5.270.0130.05720.75
5.5.260.0030.04020.96
5.5.250.0070.06720.45
5.5.240.0200.07720.18
5.4.450.0800.03319.30
5.4.440.0200.03319.41
5.4.430.0200.04019.52
5.4.420.0630.03319.63
5.4.410.0230.04319.07
5.4.400.0530.03019.14
5.4.390.0530.05319.13
5.4.380.0300.05318.74
5.4.370.0470.05018.79
5.4.360.0370.06318.50
5.4.350.0370.06318.50
5.4.340.0370.05318.68
5.4.320.0050.03612.48
5.4.310.0080.03512.47
5.4.300.0040.03912.48
5.4.290.0100.05312.47
5.4.280.0080.05112.37
5.4.270.0070.05112.37
5.4.260.0140.04812.37
5.4.250.0060.06212.37
5.4.240.0090.05312.37
5.4.230.0090.05812.36
5.4.220.0050.06112.36
5.4.210.0060.05012.36
5.4.200.0180.08112.36
5.4.190.0090.05812.36
5.4.180.0080.05212.36
5.4.170.0080.05212.37
5.4.160.0110.07412.37
5.4.150.0110.05712.36
5.4.140.0070.04312.04
5.4.130.0140.10112.03
5.4.120.0230.09911.99
5.4.110.0230.12511.99
5.4.100.0230.07711.98
5.4.90.0230.05811.98
5.4.80.0140.06211.98
5.4.70.0400.10111.98
5.4.60.0150.07711.98
5.4.50.0100.06411.98
5.4.40.0240.13511.97
5.4.30.0130.07911.97
5.4.20.0600.16911.97
5.4.10.0140.06911.97
5.4.00.0170.07011.46
5.3.290.0070.04512.80
5.3.280.0090.05612.71
5.3.270.0230.10712.72
5.3.260.0160.08812.72
5.3.250.0160.05612.72
5.3.240.0210.07812.72
5.3.230.0130.06112.71
5.3.220.0140.06612.68
5.3.210.0190.07812.68
5.3.200.0320.14812.68
5.3.190.0290.13712.68
5.3.180.0240.11212.67
5.3.170.0140.09812.67
5.3.160.0200.11812.67
5.3.150.0100.05112.67
5.3.140.0150.07212.66
5.3.130.0150.09212.66
5.3.120.0060.06812.66
5.3.110.0120.08712.66
5.3.100.0180.05712.12
5.3.90.0130.05512.10
5.3.80.0230.07712.09
5.3.70.0210.08912.09
5.3.60.0170.08112.07
5.3.50.0150.08412.02
5.3.40.0140.10912.02
5.3.30.0320.08411.98
5.3.20.0230.08411.76
5.3.10.0220.07711.73
5.3.00.0210.08511.72
5.2.170.0280.1309.21
5.2.160.0190.0689.22
5.2.150.0210.0759.22
5.2.140.0200.0809.21
5.2.130.0240.0799.18
5.2.120.0050.0519.18
5.2.110.0130.0529.18
5.2.100.0110.0559.18
5.2.90.0090.0409.18
5.2.80.0150.0689.17
5.2.70.0200.0649.17
5.2.60.0110.0949.13
5.2.50.0060.0899.10
5.2.40.0080.0349.08
5.2.30.0080.0499.05
5.2.20.0120.0559.04
5.2.10.0090.0718.93
5.2.00.0150.0698.79
5.1.60.0130.0568.08
5.1.50.0070.0348.07
5.1.40.0160.0478.05
5.1.30.0110.0528.41
5.1.20.0170.0548.43
5.1.10.0110.0958.15
5.1.00.0150.0658.14
5.0.50.0070.0466.63
5.0.40.0120.0316.50
5.0.30.0040.0556.30
5.0.20.0130.0376.27
5.0.10.0090.0456.25
5.0.00.0150.0856.24
4.4.90.0180.0524.78
4.4.80.0170.0374.75
4.4.70.0070.0404.75
4.4.60.0090.0374.75
4.4.50.0160.0414.77
4.4.40.0170.0674.71
4.4.30.0100.0354.76
4.4.20.0140.0284.85
4.4.10.0080.0274.84
4.4.00.0130.0624.76
4.3.110.0090.0464.67
4.3.100.0130.0404.67
4.3.90.0060.0184.64
4.3.80.0040.0324.58
4.3.70.0050.0234.63
4.3.60.0090.0304.63
4.3.50.0130.0364.63
4.3.40.0020.0334.54
4.3.30.0070.0383.29
4.3.20.0120.0363.25
4.3.10.0100.0363.22
4.3.00.0070.01313.17

preferences:
61.09 ms | 401 KiB | 5 Q