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_DELIM_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.40.0140.00718.72
8.3.30.0130.01018.87
8.3.20.0020.00520.18
8.3.10.0000.00823.55
8.3.00.0060.00319.38
8.2.170.0120.00322.96
8.2.160.0100.00320.26
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.01126.16
8.2.120.0040.00422.30
8.2.110.0060.00322.24
8.2.100.0060.00617.82
8.2.90.0040.00419.05
8.2.80.0080.00017.97
8.2.70.0030.00617.63
8.2.60.0000.00819.65
8.2.50.0000.00818.07
8.2.40.0000.00819.83
8.2.30.0040.00419.71
8.2.20.0040.00417.78
8.2.10.0040.00418.09
8.2.00.0040.00717.71
8.1.270.0040.00423.91
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0050.00523.91
8.1.230.0120.00018.93
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0050.00517.35
8.1.190.0040.00417.50
8.1.180.0060.00318.10
8.1.170.0030.00518.52
8.1.160.0030.00621.98
8.1.150.0030.00518.68
8.1.140.0030.00617.52
8.1.130.0070.00017.70
8.1.120.0040.00417.43
8.1.110.0080.00017.52
8.1.100.0040.00417.44
8.1.90.0040.00417.42
8.1.80.0040.00417.49
8.1.70.0000.00817.55
8.1.60.0030.00517.66
8.1.50.0080.00017.61
8.1.40.0000.00817.61
8.1.30.0080.00017.75
8.1.20.0000.00817.77
8.1.10.0050.00317.53
8.1.00.0040.00417.60
8.0.300.0050.00320.75
8.0.290.0040.00417.18
8.0.280.0070.00018.32
8.0.270.0000.00717.23
8.0.260.0000.00617.10
8.0.250.0030.00317.07
8.0.240.0070.00016.96
8.0.230.0040.00716.94
8.0.220.0030.00316.97
8.0.210.0000.00717.04
8.0.200.0030.00317.04
8.0.190.0040.00416.89
8.0.180.0070.00017.02
8.0.170.0040.00417.00
8.0.160.0030.00317.04
8.0.150.0050.00216.88
8.0.140.0020.00516.96
8.0.130.0030.00313.47
8.0.120.0040.00417.05
8.0.110.0040.00416.94
8.0.100.0000.00716.95
8.0.90.0000.00716.84
8.0.80.0130.00317.00
8.0.70.0000.00716.80
8.0.60.0040.00416.95
8.0.50.0040.00416.89
8.0.30.0100.01117.06
8.0.20.0140.00417.42
8.0.10.0070.00017.06
8.0.00.0070.01216.81
7.4.330.0020.00215.00
7.4.320.0000.00716.55
7.4.300.0030.00316.63
7.4.290.0040.00716.77
7.4.280.0000.00816.66
7.4.270.0040.00416.64
7.4.260.0040.00416.63
7.4.250.0000.00816.68
7.4.240.0030.00316.71
7.4.230.0000.00716.86
7.4.220.0100.00716.71
7.4.210.0070.00816.61
7.4.200.0040.00416.76
7.4.190.0000.00716.75
7.4.160.0090.00616.59
7.4.150.0100.01417.40
7.4.140.0100.00717.86
7.4.130.0080.01316.68
7.4.120.0110.00916.44
7.4.110.0000.01716.48
7.4.100.0130.00616.77
7.4.90.0110.00716.63
7.4.80.0060.01219.39
7.4.70.0070.01016.45
7.4.60.0030.01516.49
7.4.50.0040.00416.48
7.4.40.0060.01022.77
7.4.30.0110.00616.57
7.4.00.0030.00615.14
7.3.330.0000.00613.13
7.3.320.0000.00513.22
7.3.310.0040.00416.36
7.3.300.0030.00316.28
7.3.290.0050.01116.29
7.3.280.0080.01116.26
7.3.270.0040.01417.40
7.3.260.0060.01016.71
7.3.250.0100.01016.46
7.3.240.0090.01216.22
7.3.230.0080.00816.61
7.3.210.0130.00316.33
7.3.200.0120.00919.39
7.3.190.0130.00316.19
7.3.180.0070.01416.54
7.3.170.0040.01116.36
7.3.160.0100.00716.71
7.3.120.0070.00414.77
7.2.330.0110.00716.51
7.2.320.0130.00616.55
7.2.310.0100.00616.75
7.2.300.0100.01316.71
7.2.290.0000.02016.59
7.2.00.0040.00819.29
7.1.100.0050.00518.21
7.1.70.0030.00717.07
7.1.60.0000.01619.46
7.1.50.0140.00717.00
7.1.00.0030.07722.55
7.0.200.0030.00616.87
7.0.140.0000.07722.00
7.0.110.0030.08720.00
7.0.100.0100.06319.91
7.0.90.0100.07719.86
7.0.80.0100.08319.93
7.0.70.0100.08319.99
7.0.60.0100.08019.94
7.0.50.0070.08720.12
7.0.40.0100.04720.01
7.0.30.0170.07720.19
7.0.20.0170.07720.14
7.0.10.0170.07320.06
7.0.00.0130.06020.13
5.6.280.0100.06321.09
5.6.250.0070.06020.63
5.6.240.0130.08020.64
5.6.230.0130.06320.48
5.6.220.0000.08320.57
5.6.210.0030.07720.62
5.6.200.0070.08021.02
5.6.190.0100.08321.21
5.6.180.0100.05320.97
5.6.170.0130.07020.93
5.6.160.0030.08321.09
5.6.150.0100.07721.22
5.6.140.0070.08020.89
5.6.130.0100.07721.06
5.6.120.0070.06721.13
5.6.110.0070.06321.01
5.6.100.0030.08021.07
5.6.90.0070.08321.04
5.6.80.0100.07320.61
5.6.70.0200.05720.24
5.6.60.0070.05020.26
5.6.50.0100.06320.47
5.6.40.0030.08020.44
5.6.30.0070.04720.41
5.6.20.0000.05320.43
5.6.10.0030.08020.38
5.6.00.0100.07720.47
5.5.380.0070.05020.32
5.5.370.0170.06720.19
5.5.360.0130.07720.31
5.5.350.0100.06720.35
5.5.340.0130.07720.75
5.5.330.0230.06320.89
5.5.320.0100.07720.95
5.5.310.0100.04720.89
5.5.300.0100.04720.89
5.5.290.0030.08720.81
5.5.280.0070.04020.89
5.5.270.0070.05320.71
5.5.260.0030.09020.83
5.5.250.0170.07320.57
5.5.240.0000.06020.21
5.5.230.0070.04020.22
5.5.220.0070.08320.02
5.5.210.0100.07020.02
5.5.200.0000.08020.31
5.5.190.0030.08720.24
5.5.180.0070.07720.18
5.5.160.0130.08020.03
5.5.150.0030.08020.18
5.5.140.0030.07720.15
5.5.130.0100.06320.18
5.5.120.0030.06720.19
5.5.110.0100.07320.17
5.5.100.0200.07019.95
5.5.90.0170.07020.08
5.5.80.0070.07320.15
5.5.70.0030.07720.18
5.5.60.0130.06720.20
5.5.50.0070.07719.97
5.5.40.0130.04320.12
5.5.30.0030.07020.15
5.5.20.0030.04319.90
5.5.10.0030.04020.16
5.5.00.0030.04020.05
5.4.450.0170.06719.32
5.4.440.0000.08719.30
5.4.430.0130.07019.34
5.4.420.0070.05719.33
5.4.410.0030.08019.53
5.4.400.0000.05019.34
5.4.390.0030.06718.94
5.4.380.0070.03719.23
5.4.370.0100.06318.99
5.4.360.0100.07718.98
5.4.350.0130.06719.19
5.4.340.0100.04719.18
5.4.320.0070.03719.18
5.4.310.0070.06319.01
5.4.300.0070.07319.18
5.4.290.0070.07718.94
5.4.280.0070.08019.33
5.4.270.0100.04719.02
5.4.260.0100.08019.00
5.4.250.0000.08019.13
5.4.240.0070.07319.13
5.4.230.0100.07019.02
5.4.220.0100.07719.00
5.4.210.0070.06719.00
5.4.200.0100.04319.15
5.4.190.0070.03718.99
5.4.180.0000.04019.13
5.4.170.0030.05018.96
5.4.160.0100.03018.98
5.4.150.0070.03718.98
5.4.140.0070.03316.57
5.4.130.0000.03716.23
5.4.120.0030.03716.49
5.4.110.0000.03716.25
5.4.100.0030.03716.43
5.4.90.0000.04016.42
5.4.80.0000.05316.26
5.4.70.0030.04316.56
5.4.60.0070.03016.38
5.4.50.0030.03316.44
5.4.40.0070.05716.45
5.4.30.0030.04716.39
5.4.20.0070.03016.37
5.4.10.0030.03716.47
5.4.00.0070.03315.98
5.3.290.0030.07714.66
5.3.280.0200.06314.58
5.3.270.0070.04014.73
5.3.260.0070.04314.72
5.3.250.0030.03714.55
5.3.240.0030.03714.60
5.3.230.0070.03314.58
5.3.220.0030.03714.59
5.3.210.0000.04014.70
5.3.200.0170.03014.64
5.3.190.0030.04014.55
5.3.180.0030.04314.57
5.3.170.0000.04014.63
5.3.160.0030.03714.51
5.3.150.0030.03714.56
5.3.140.0030.04014.63
5.3.130.0030.06314.57
5.3.120.0000.04014.77
5.3.110.0000.04014.54
5.3.100.0070.03314.04
5.3.90.0030.03713.99
5.3.80.0070.03014.07
5.3.70.0030.06013.98
5.3.60.0070.03014.00
5.3.50.0000.04314.01
5.3.40.0030.03714.16
5.3.30.0070.04013.88
5.3.20.0130.04713.78
5.3.10.0000.03713.88
5.3.00.0070.03013.59
5.2.170.0000.03711.67
5.2.160.0070.04711.67
5.2.150.0000.03011.67
5.2.140.0130.01711.67
5.2.130.0000.03011.67
5.2.120.0030.02711.67
5.2.110.0000.03311.67
5.2.100.0030.02711.67
5.2.90.0070.02711.67
5.2.80.0000.03011.67
5.2.70.0070.02311.67
5.2.60.0030.02711.67
5.2.50.0070.02311.67
5.2.40.0070.02711.67
5.2.30.0000.05011.67
5.2.20.0030.03011.67
5.2.10.0000.03011.67
5.2.00.0000.03011.67
5.1.60.0030.02311.67
5.1.50.0000.02711.67
5.1.40.0000.03011.67
5.1.30.0070.05311.67
5.1.20.0030.05711.67
5.1.10.0000.05711.67
5.1.00.0070.05311.67
5.0.50.0070.03711.67
5.0.40.0100.03311.67
5.0.30.0070.05311.67
5.0.20.0000.04711.67
5.0.10.0030.04311.67
5.0.00.0070.05711.67
4.4.90.0070.01011.67
4.4.80.0070.01011.67
4.4.70.0000.01711.67
4.4.60.0030.01311.67
4.4.50.0000.02011.67
4.4.40.0000.02311.67
4.4.30.0000.03711.67
4.4.20.0000.04011.67
4.4.10.0070.01711.67
4.4.00.0000.03011.67
4.3.110.0100.02711.67
4.3.100.0030.02311.67
4.3.90.0030.01711.67
4.3.80.0070.04711.67
4.3.70.0000.04011.67
4.3.60.0070.02011.67
4.3.50.0030.03311.67
4.3.40.0030.05011.67
4.3.30.0070.02711.67
4.3.20.0000.03311.67
4.3.10.0030.03311.67
4.3.00.0030.03311.67

preferences:
41.02 ms | 400 KiB | 5 Q