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); //$string = $arr[0][0][0]; $start_tag = strrpos($arr[0],'{'); print_r($arr); echo substr($arr[0],0,$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.0000.01416.85
8.3.50.0090.01122.07
8.3.40.0140.00718.86
8.3.30.0140.00018.91
8.3.20.0040.00420.29
8.3.10.0000.00723.53
8.3.00.0080.00019.38
8.2.180.0180.00018.52
8.2.170.0100.00722.96
8.2.160.0100.00320.38
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00822.32
8.2.110.0040.00422.21
8.2.100.0070.00417.97
8.2.90.0080.00019.22
8.2.80.0000.00818.16
8.2.70.0030.00617.88
8.2.60.0080.00017.93
8.2.50.0000.00818.07
8.2.40.0040.00419.94
8.2.30.0040.00419.81
8.2.20.0030.00717.95
8.2.10.0040.00419.74
8.2.00.0030.00717.85
8.1.270.0080.00023.83
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0000.00923.96
8.1.230.0070.00319.00
8.1.220.0060.00317.74
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0000.00817.28
8.1.180.0120.00018.10
8.1.170.0000.01118.66
8.1.160.0000.00921.82
8.1.150.0040.00418.79
8.1.140.0050.00317.45
8.1.130.0000.00817.85
8.1.120.0040.00417.45
8.1.110.0030.00517.47
8.1.100.0040.00417.55
8.1.90.0070.00017.41
8.1.80.0000.00917.60
8.1.70.0000.00717.46
8.1.60.0040.00417.58
8.1.50.0000.00817.67
8.1.40.0040.00417.57
8.1.30.0040.00417.70
8.1.20.0040.00417.66
8.1.10.0000.00917.70
8.1.00.0050.00217.52
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0070.00018.47
8.0.270.0070.00017.18
8.0.260.0060.00017.35
8.0.250.0030.00317.19
8.0.240.0040.00417.10
8.0.230.0040.00417.00
8.0.220.0040.00416.97
8.0.210.0060.00316.89
8.0.200.0040.00416.93
8.0.190.0030.00617.09
8.0.180.0030.00616.98
8.0.170.0080.00016.86
8.0.160.0070.00016.92
8.0.150.0030.00316.89
8.0.140.0030.00316.97
8.0.130.0030.00313.42
8.0.120.0070.00016.96
8.0.110.0000.00817.04
8.0.100.0040.00416.95
8.0.90.0000.00716.93
8.0.80.0160.00716.93
8.0.70.0040.00416.94
8.0.60.0020.00516.85
8.0.50.0000.00816.83
8.0.30.0090.00917.35
8.0.20.0140.00717.40
8.0.10.0000.00716.90
8.0.00.0110.00716.92
7.4.330.0050.00015.00
7.4.320.0000.00616.76
7.4.300.0030.00316.73
7.4.290.0040.00416.66
7.4.280.0070.00316.64
7.4.270.0040.00416.59
7.4.260.0000.00716.68
7.4.250.0050.00316.69
7.4.240.0030.00416.75
7.4.230.0000.00716.66
7.4.220.0100.00716.70
7.4.210.0050.01216.63
7.4.200.0040.00416.78
7.4.190.0050.00216.65
7.4.160.0060.01016.63
7.4.150.0180.00017.40
7.4.140.0100.00717.86
7.4.130.0100.00916.63
7.4.120.0050.01216.75
7.4.110.0150.00916.70
7.4.100.0180.00016.55
7.4.90.0060.01216.66
7.4.80.0160.01319.39
7.4.70.0060.01516.84
7.4.60.0100.00716.61
7.4.50.0000.00616.62
7.4.40.0100.00622.77
7.4.30.0090.00916.73
7.4.00.0050.01115.07
7.3.330.0030.00313.29
7.3.320.0060.00013.28
7.3.310.0030.00616.50
7.3.300.0000.00716.35
7.3.290.0110.00316.32
7.3.280.0100.01216.36
7.3.270.0100.00717.40
7.3.260.0080.01116.61
7.3.250.0120.00616.51
7.3.240.0080.00916.48
7.3.230.0030.01716.43
7.3.210.0160.00016.79
7.3.200.0210.00319.39
7.3.190.0080.01216.43
7.3.180.0130.00716.68
7.3.170.0000.02016.63
7.3.160.0120.00316.44
7.3.120.0060.01014.81
7.3.110.0110.00715.01
7.3.100.0120.00814.94
7.3.90.0030.01014.58
7.3.80.0070.00715.14
7.3.70.0060.00615.15
7.3.60.0030.01014.81
7.3.50.0070.00314.67
7.3.40.0030.00614.83
7.3.30.0000.01514.75
7.3.20.0060.00616.88
7.3.10.0110.00316.76
7.3.00.0080.00416.66
7.2.330.0150.00416.66
7.2.320.0070.01416.50
7.2.310.0110.00616.95
7.2.300.0100.00716.76
7.2.290.0130.00916.75
7.2.250.0090.00915.40
7.2.240.0060.01215.39
7.2.230.0070.00715.25
7.2.220.0030.01015.09
7.2.210.0030.00715.24
7.2.200.0040.00914.98
7.2.190.0090.00014.95
7.2.180.0070.00714.85
7.2.170.0070.01015.27
7.2.160.0040.00814.86
7.2.150.0030.01016.97
7.2.140.0070.00717.20
7.2.130.0100.00716.77
7.2.120.0080.00516.75
7.2.110.0030.00716.91
7.2.100.0070.01116.85
7.2.90.0090.00917.04
7.2.80.0090.00917.08
7.2.70.0070.00717.02
7.2.60.0080.00617.12
7.2.50.0060.01016.78
7.2.40.0120.00316.97
7.2.30.0090.00616.84
7.2.20.0070.00317.23
7.2.10.0090.00617.02
7.2.00.0050.00918.38
7.1.330.0070.01016.05
7.1.320.0070.00715.90
7.1.310.0040.00416.02
7.1.300.0070.00415.80
7.1.290.0000.01215.58
7.1.280.0030.01016.11
7.1.270.0150.00016.01
7.1.260.0060.00315.76
7.1.250.0090.00615.48
7.1.240.0040.01115.70
7.1.230.0030.01115.84
7.1.220.0070.00715.91
7.1.210.0030.01315.93
7.1.200.0040.00515.83
7.1.190.0120.00016.04
7.1.180.0060.00615.85
7.1.170.0070.00715.91
7.1.160.0080.00415.79
7.1.150.0090.00315.93
7.1.140.0070.00716.09
7.1.130.0060.00316.07
7.1.120.0040.01115.98
7.1.110.0040.01016.05
7.1.100.0110.00816.24
7.1.90.0000.01215.83
7.1.80.0040.00815.89
7.1.70.0030.00816.65
7.1.60.0080.00717.77
7.1.50.0070.00916.50
7.1.40.0110.00415.77
7.1.30.0060.00915.94
7.1.20.0060.00615.86
7.1.10.0050.00516.00
7.1.00.0080.04019.21
7.0.330.0100.00715.43
7.0.320.0070.00715.36
7.0.310.0060.00615.55
7.0.300.0000.01515.20
7.0.290.0060.00615.35
7.0.280.0070.00315.58
7.0.270.0030.00815.51
7.0.260.0030.01015.48
7.0.250.0060.00315.41
7.0.240.0040.00715.62
7.0.230.0040.00715.75
7.0.220.0030.00715.62
7.0.210.0000.00915.59
7.0.200.0030.00816.22
7.0.190.0060.00615.35
7.0.180.0030.00915.46
7.0.170.0030.00915.69
7.0.160.0060.00915.46
7.0.150.0060.00615.43
7.0.140.0040.04118.63
7.0.130.0040.01115.44
7.0.120.0050.00515.36
7.0.110.0040.01115.20
7.0.100.0070.02517.82
7.0.90.0050.02717.67
7.0.80.0060.04117.79
7.0.70.0060.02617.80
7.0.60.0070.04517.72
7.0.50.0050.03017.74
7.0.40.0080.02116.80
7.0.30.0050.03516.92
7.0.20.0060.02016.84
7.0.10.0020.04016.90
7.0.00.0050.03816.70
5.6.400.0030.00914.41
5.6.390.0070.00714.59
5.6.380.0000.01414.39
5.6.370.0060.00914.57
5.6.360.0000.01714.34
5.6.350.0100.00313.98
5.6.340.0030.01014.43
5.6.330.0040.00714.20
5.6.320.0090.00314.48
5.6.310.0060.00914.62
5.6.300.0110.00414.41
5.6.290.0000.01814.14
5.6.280.0050.03817.75
5.6.270.0080.00814.38
5.6.260.0090.00614.33
5.6.250.0070.02217.54
5.6.240.0080.04317.38
5.6.230.0090.04417.50
5.6.220.0110.02717.49
5.6.210.0080.02317.65
5.6.200.0080.02017.68
5.6.190.0030.02517.70
5.6.180.0040.02217.75
5.6.170.0050.02917.70
5.6.160.0020.02617.59
5.6.150.0040.02417.60
5.6.140.0060.02217.79
5.6.130.0040.02717.86
5.6.120.0050.04617.81
5.6.110.0050.04717.74
5.6.100.0030.04717.71
5.6.90.0080.04117.66
5.6.80.0070.04317.35
5.6.70.0120.04017.42
5.6.60.0030.04417.37
5.6.50.0060.04017.40
5.6.40.0050.04917.27
5.6.30.0170.03717.42
5.6.20.0160.03517.39
5.6.10.0050.04517.27
5.6.00.0110.03817.44
5.5.380.0110.03517.46
5.5.370.0100.03317.26
5.5.360.0060.04317.19
5.5.350.0050.04817.36
5.5.340.0060.02317.43
5.5.330.0070.02317.47
5.5.320.0070.02217.49
5.5.310.0020.03017.56
5.5.300.0040.02417.65
5.5.290.0050.04017.39
5.5.280.0030.04517.60
5.5.270.0120.03817.37
5.5.260.0030.04717.58
5.5.250.0120.04317.31
5.5.240.0080.03817.05
5.5.230.0080.04517.27
5.5.220.0040.04617.26
5.5.210.0090.04017.01
5.5.200.0030.04517.22
5.5.190.0100.04217.11
5.5.180.0040.04416.94
5.5.170.0060.00614.36
5.5.160.0140.03417.13
5.5.150.0080.03917.22
5.5.140.0050.04517.04
5.5.130.0070.04517.27
5.5.120.0110.03516.90
5.5.110.0020.03317.19
5.5.100.0110.04017.06
5.5.90.0070.03017.18
5.5.80.0100.04217.10
5.5.70.0060.04117.03
5.5.60.0080.04117.08
5.5.50.0030.04716.93
5.5.40.0080.04617.02
5.5.30.0070.04217.18
5.5.20.0070.04217.15
5.5.10.0070.04517.12
5.5.00.0070.04017.09
5.4.450.0030.02315.03
5.4.440.0100.03315.24
5.4.430.0070.04215.35
5.4.420.0060.02515.14
5.4.410.0110.03515.30
5.4.400.0070.03914.97
5.4.390.0070.04315.01
5.4.380.0070.03514.93
5.4.370.0060.04315.09
5.4.360.0050.04115.09
5.4.350.0080.03915.07
5.4.340.0070.03915.03
5.4.330.0060.00611.07
5.4.320.0050.03915.09
5.4.310.0080.04114.98
5.4.300.0100.03714.86
5.4.290.0070.03914.95
5.4.280.0050.04315.07
5.4.270.0100.03715.12
5.4.260.0020.04315.03
5.4.250.0100.03815.00
5.4.240.0050.04015.22
5.4.230.0080.03515.03
5.4.220.0080.03815.16
5.4.210.0040.03115.07
5.4.200.0070.03814.88
5.4.190.0030.04114.97
5.4.180.0120.03714.92
5.4.170.0050.04215.05
5.4.160.0020.04414.96
5.4.150.0050.03915.02
5.4.140.0030.03813.78
5.4.130.0050.02513.51
5.4.120.0090.04013.73
5.4.110.0110.03313.89
5.4.100.0070.03813.55
5.4.90.0080.03613.57
5.4.80.0030.02613.81
5.4.70.0030.03713.84
5.4.60.0080.03713.77
5.4.50.0070.02613.76
5.4.40.0100.03613.94
5.4.30.0100.03313.76
5.4.20.0080.03813.62
5.4.10.0060.04313.64
5.4.00.0100.03613.43
5.3.290.0060.02412.79
5.3.280.0080.03612.62
5.3.270.0050.02812.64
5.3.260.0070.03412.64
5.3.250.0080.02312.53
5.3.240.0100.03812.62
5.3.230.0000.04512.53
5.3.220.0110.03312.59
5.3.210.0070.04312.47
5.3.200.0110.03312.64
5.3.190.0050.02012.60
5.3.180.0110.03012.61
5.3.170.0030.04112.52
5.3.160.0100.03812.50
5.3.150.0070.04412.64
5.3.140.0070.04112.54
5.3.130.0070.03712.57
5.3.120.0120.03212.55
5.3.110.0090.03612.57
5.3.100.0050.02512.40
5.3.90.0090.03512.39
5.3.80.0120.03012.26
5.3.70.0070.02612.28
5.3.60.0030.04312.36
5.3.50.0080.03512.15
5.3.40.0000.03312.19
5.3.30.0030.04112.31
5.3.20.0090.03812.33
5.3.10.0030.03012.16
5.3.00.0060.03612.20
5.2.170.0070.03314.08
5.2.160.0070.06014.08
5.2.150.0070.06314.08
5.2.140.0000.07014.08
5.2.130.0070.03714.08
5.2.120.0100.05314.08
5.2.110.0030.06714.08
5.2.100.0030.05314.08
5.2.90.0030.05014.08
5.2.80.0070.05314.08
5.2.70.0100.04714.08
5.2.60.0030.05714.08
5.2.50.0100.05714.08
5.2.40.0100.04714.08
5.2.30.0070.05014.08
5.2.20.0070.06314.08
5.2.10.0030.05714.08
5.2.00.0100.06014.08
5.1.60.0030.05714.08
5.1.50.0000.06014.08
5.1.40.0070.04014.08
5.1.30.0030.05714.08
5.1.20.0000.06014.08
5.1.10.0030.05714.08
5.1.00.0130.05014.08
5.0.50.0070.04314.08
5.0.40.0000.04714.08
5.0.30.0070.06314.08
5.0.20.0030.04714.08
5.0.10.0030.04314.08
5.0.00.0070.06014.08
4.4.90.0030.02714.08
4.4.80.0030.03714.08
4.4.70.0030.03714.08
4.4.60.0100.02714.08
4.4.50.0000.03714.08
4.4.40.0070.05314.08
4.4.30.0070.03014.08
4.4.20.0000.03714.08
4.4.10.0000.04014.08
4.4.00.0000.05314.08
4.3.110.0070.03314.08
4.3.100.0030.03714.08
4.3.90.0100.02714.08
4.3.80.0030.04014.08
4.3.70.0000.02014.08
4.3.60.0000.03714.08
4.3.50.0030.03014.08
4.3.40.0070.05014.08
4.3.30.0030.03314.08
4.3.20.0070.03314.08
4.3.10.0000.03014.08
4.3.00.0000.03714.08

preferences:
44.78 ms | 400 KiB | 5 Q