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($end_loop_regex,$endfor_str,$arr,PREG_OFFSET_CAPTURE); //$string = $arr[0][0][0]; $start_tag = strrpos($arr[0][0],'{'); print_r($arr); echo $start_tag; //$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.0080.00816.63
8.3.50.0140.00521.92
8.3.40.0110.00818.90
8.3.30.0040.01119.17
8.3.20.0070.00020.34
8.3.10.0080.00023.52
8.3.00.0000.00819.51
8.2.180.0150.00318.66
8.2.170.0070.00722.96
8.2.160.0070.00720.27
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0130.00626.16
8.2.120.0040.00422.21
8.2.110.0090.00022.08
8.2.100.0040.00818.13
8.2.90.0070.00019.30
8.2.80.0030.00618.05
8.2.70.0030.00617.88
8.2.60.0040.00419.65
8.2.50.0090.00018.07
8.2.40.0000.00819.88
8.2.30.0040.00419.89
8.2.20.0050.00218.00
8.2.10.0000.00718.16
8.2.00.0070.00318.01
8.1.280.0100.00725.92
8.1.270.0060.00323.91
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0100.00023.79
8.1.230.0070.00419.22
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0000.00917.40
8.1.180.0060.00318.10
8.1.170.0040.00418.62
8.1.160.0050.00521.85
8.1.150.0040.00418.73
8.1.140.0040.00417.54
8.1.130.0030.00317.86
8.1.120.0000.00717.55
8.1.110.0020.00517.51
8.1.100.0030.00317.43
8.1.90.0040.00417.58
8.1.80.0020.00517.37
8.1.70.0070.00017.53
8.1.60.0040.00417.56
8.1.50.0040.00417.56
8.1.40.0000.00817.64
8.1.30.0030.00517.61
8.1.20.0070.00017.61
8.1.10.0050.00217.75
8.1.00.0060.00317.65
8.0.300.0000.00820.78
8.0.290.0000.00717.05
8.0.280.0030.00318.53
8.0.270.0000.00717.28
8.0.260.0030.00317.16
8.0.250.0080.00017.09
8.0.240.0070.00017.18
8.0.230.0000.00717.06
8.0.220.0040.00316.89
8.0.210.0030.00616.89
8.0.200.0040.00417.06
8.0.190.0000.00817.00
8.0.180.0050.00316.98
8.0.170.0040.00416.90
8.0.160.0000.00817.01
8.0.150.0080.00016.94
8.0.140.0040.00416.86
8.0.130.0030.00313.40
8.0.120.0000.00816.93
8.0.110.0040.00316.96
8.0.100.0000.00716.88
8.0.90.0050.00216.98
8.0.80.0090.01317.02
8.0.70.0040.00416.94
8.0.60.0040.00416.82
8.0.50.0070.00017.09
8.0.30.0160.00317.14
8.0.20.0140.00817.40
8.0.10.0000.00816.95
8.0.00.0070.01017.07
7.4.330.0050.00015.10
7.4.320.0000.00716.58
7.4.300.0030.00316.76
7.4.290.0080.00316.65
7.4.280.0070.00316.66
7.4.270.0080.00016.74
7.4.260.0030.00316.54
7.4.250.0000.00916.75
7.4.240.0000.00716.67
7.4.230.0030.00516.79
7.4.220.0120.01216.82
7.4.210.0060.00816.74
7.4.200.0040.00416.68
7.4.190.0030.00616.72
7.4.160.0120.00416.66
7.4.150.0070.01117.40
7.4.140.0120.00517.86
7.4.130.0080.00916.65
7.4.120.0080.01016.70
7.4.110.0220.00016.49
7.4.100.0150.00616.73
7.4.90.0130.00616.58
7.4.80.0100.00619.39
7.4.70.0070.01016.42
7.4.60.0140.00316.58
7.4.50.0000.00816.55
7.4.40.0070.01022.77
7.4.30.0070.00716.65
7.4.00.0110.00314.74
7.3.330.0000.00513.17
7.3.320.0000.00513.29
7.3.310.0070.00016.36
7.3.300.0070.00016.34
7.3.290.0070.00816.49
7.3.280.0120.00916.46
7.3.270.0090.00917.40
7.3.260.0090.00916.56
7.3.250.0140.00716.63
7.3.240.0080.01116.51
7.3.230.0130.01016.78
7.3.210.0140.00316.70
7.3.200.0110.00719.39
7.3.190.0120.00416.49
7.3.180.0130.00316.74
7.3.170.0170.00016.41
7.3.160.0090.00916.50
7.3.120.0080.00415.18
7.3.110.0070.01314.76
7.3.100.0040.01214.96
7.3.90.0040.00714.82
7.3.80.0000.01415.15
7.3.70.0030.00914.99
7.3.60.0040.00715.09
7.3.50.0040.00815.02
7.3.40.0070.00714.70
7.3.30.0000.01514.85
7.3.20.0060.00916.79
7.3.10.0080.00416.70
7.3.00.0060.00816.97
7.2.330.0070.01016.83
7.2.320.0130.00316.86
7.2.310.0100.00716.67
7.2.300.0130.00716.85
7.2.290.0060.01116.79
7.2.240.0100.01015.21
7.2.230.0130.00315.07
7.2.220.0000.01515.00
7.2.210.0110.00314.90
7.2.200.0090.00315.10
7.2.190.0090.00614.98
7.2.180.0000.01015.18
7.2.170.0030.00615.20
7.2.160.0060.00914.93
7.2.150.0030.01017.02
7.2.140.0000.01217.03
7.2.130.0060.00617.02
7.2.120.0030.00616.83
7.2.110.0000.01517.21
7.2.100.0000.01116.98
7.2.90.0000.01317.02
7.2.80.0100.00316.96
7.2.70.0060.00616.89
7.2.60.0060.00917.04
7.2.50.0100.00616.91
7.2.40.0060.01017.07
7.2.30.0040.00817.28
7.2.20.0070.00717.26
7.2.10.0060.00917.06
7.2.00.0060.00618.40
7.1.330.0000.01915.81
7.1.320.0000.01415.93
7.1.310.0140.00015.72
7.1.300.0060.01016.07
7.1.290.0090.00615.83
7.1.280.0070.00715.60
7.1.270.0090.00315.93
7.1.260.0070.01116.09
7.1.250.0060.00915.87
7.1.100.0100.00718.39
7.1.70.0040.00417.24
7.1.60.0000.01519.46
7.1.50.0120.00917.25
7.1.00.0030.07722.33
7.0.200.0000.00916.96
7.0.140.0170.06021.95
7.0.60.0070.06719.84
7.0.50.0070.08017.90
7.0.40.0030.04320.15
7.0.30.0270.05320.09
7.0.20.0370.07320.12
7.0.10.0070.07320.28
7.0.00.0030.08720.08
5.6.280.0070.07021.09
5.6.210.0100.07720.76
5.6.200.0100.07318.29
5.6.190.0030.04320.50
5.6.180.0230.06720.50
5.6.170.0230.04320.39
5.6.160.0270.04320.50
5.6.150.0030.04318.28
5.6.140.0000.04318.18
5.6.130.0100.07718.14
5.6.120.0030.09021.03
5.6.110.0130.08321.13
5.6.100.0100.07021.08
5.6.90.0030.05021.09
5.6.80.0100.05320.41
5.5.350.0370.05020.43
5.5.340.0070.05718.08
5.5.330.0000.04720.21
5.5.320.0230.03720.37
5.5.310.0200.08320.32
5.5.300.0100.05318.08
5.5.290.0030.04017.97
5.5.280.0000.04720.84
5.5.270.0030.05720.63
5.5.260.0130.07720.95
5.5.250.0030.08020.69
5.5.240.3330.03320.03
5.4.450.0730.05319.47
5.4.440.0830.07019.46
5.4.430.0000.06019.29
5.4.420.0730.04319.59
5.4.410.0730.06719.32
5.4.400.0170.06019.22
5.4.390.0600.05318.97
5.4.380.0300.05318.76
5.4.370.1100.06718.71
5.4.360.0300.05018.77
5.4.350.0300.06018.51
5.4.340.0270.05318.52
5.4.320.0060.04112.48
5.4.310.0020.04212.48
5.4.300.0070.03512.48
5.4.290.0060.05312.47
5.4.280.0070.05312.37
5.4.270.0070.04012.37
5.4.260.0050.06812.37
5.4.250.0140.11012.37
5.4.240.0090.06712.37
5.4.230.0120.05512.36
5.4.220.0110.05512.36
5.4.210.0100.04012.36
5.4.200.0160.06412.36
5.4.190.0110.05112.36
5.4.180.0110.04712.36
5.4.170.0080.04312.37
5.4.160.0120.06412.37
5.4.150.0090.05112.36
5.4.140.0090.04012.05
5.4.130.0090.03712.03
5.4.120.0080.03911.99
5.4.110.0080.03811.99
5.4.100.0070.04011.98
5.4.90.0060.04511.99
5.4.80.0130.03511.99
5.4.70.0070.03811.98
5.4.60.0060.04111.98
5.4.50.0090.03911.98
5.4.40.0070.03811.97
5.4.30.0070.04311.97
5.4.20.0090.03711.97
5.4.10.0090.03911.97
5.4.00.0080.04211.46
5.3.290.0050.04012.80
5.3.280.0060.04712.71
5.3.270.0110.05112.72
5.3.260.0080.04612.72
5.3.250.0030.04612.72
5.3.240.0060.04312.72
5.3.230.0090.03812.71
5.3.220.0110.06312.68
5.3.210.0250.10012.68
5.3.200.0200.08712.68
5.3.190.0150.07012.68
5.3.180.0070.05412.68
5.3.170.0050.05112.67
5.3.160.0130.05512.68
5.3.150.0180.05712.67
5.3.140.0070.04912.66
5.3.130.0070.04212.65
5.3.120.0140.06312.65
5.3.110.0160.10412.66
5.3.100.0080.05712.11
5.3.90.0110.05212.10
5.3.80.0120.07812.09
5.3.70.0210.07212.09
5.3.60.0180.06112.08
5.3.50.0120.05212.04
5.3.40.0100.06512.02
5.3.30.0080.05011.98
5.3.20.0130.05211.76
5.3.10.0160.08211.73
5.3.00.0090.04811.71
5.2.170.0070.0419.22
5.2.160.0070.0649.21
5.2.150.0090.0479.21
5.2.140.0070.0419.21
5.2.130.0060.0299.18
5.2.120.0090.0409.18
5.2.110.0090.0409.18
5.2.100.0070.0429.18
5.2.90.0070.0409.17
5.2.80.0090.0599.17
5.2.70.0080.0409.17
5.2.60.0070.0419.13
5.2.50.0090.0389.10
5.2.40.0040.0349.07
5.2.30.0070.0359.05
5.2.20.0080.0349.04
5.2.10.0050.0338.93
5.2.00.0050.0408.80
5.1.60.0040.0358.08
5.1.50.0080.0298.07
5.1.40.0040.0378.06
5.1.30.0050.0398.41
5.1.20.0080.0428.43
5.1.10.0090.0628.15
5.1.00.0080.0338.14
5.0.50.0030.0226.63
5.0.40.0020.0236.50
5.0.30.0040.0336.30
5.0.20.0030.0226.27
5.0.10.0090.0486.25
5.0.00.0030.0326.25
4.4.90.0030.0164.78
4.4.80.0050.0164.76
4.4.70.0050.0174.76
4.4.60.0030.0234.76
4.4.50.0070.0344.77
4.4.40.0080.0514.70
4.4.30.0050.0274.76
4.4.20.0040.0264.84
4.4.10.0090.0364.85
4.4.00.0060.0324.76
4.3.110.0060.0304.67
4.3.100.0050.0154.66
4.3.90.0040.0154.64
4.3.80.0050.0244.58
4.3.70.0060.0134.63
4.3.60.0050.0174.63
4.3.50.0070.0204.63
4.3.40.0040.0274.54
4.3.30.0040.0223.29
4.3.20.0040.0213.27
4.3.10.0050.0183.23
4.3.00.0270.01710.54

preferences:
39.37 ms | 401 KiB | 5 Q