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); echo preg_replace($exp,'','{% for ad in ads %} <a href="{{ad.url}}">{{ad.name}}</a> <ul> <li>Ad: <a href="{{ad.url}}">{{ad.name}}({{ad.id}})</a></li> <li>Client: {{ad.client_name}} ({{ad.client_id}})</li> <li>Price: {{ad.price}}</li> <li>Expected Revenue: {{ad.expected_revenue}}</li> <li>Display Url: {{ad.display_url}}</li> <li>Headline: {{ad.headline}}</li> <li>Body: {{ad.body}}</li> <li>Logo: <img src="{{ad.logo.url}}"/></li> <li>Type: {{ad.type}}</li> {% if ad.conditions|length %} <li>Conditions: </li> <ul> {% for condition in ad.conditions %} <li>{{condition.conditiontype.name}} {{condition.operator}} {{condition.value}} </li> {% endfor %} </ul> {% endif %} </ul> {% endfor %}'); //$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.0110.01118.96
8.3.30.0070.00718.84
8.3.20.0040.00420.34
8.3.10.0040.00423.48
8.3.00.0040.00419.38
8.2.170.0070.00722.96
8.2.160.0130.00620.35
8.2.150.0110.00724.18
8.2.140.0040.00424.66
8.2.130.0130.00726.16
8.2.120.0080.00022.29
8.2.110.0030.00720.39
8.2.100.0040.00718.03
8.2.90.0040.00418.22
8.2.80.0000.00918.03
8.2.70.0000.00817.88
8.2.60.0000.00917.93
8.2.50.0080.00018.07
8.2.40.0000.00820.19
8.2.30.0050.00520.00
8.2.20.0050.00317.93
8.2.10.0000.00818.07
8.2.00.0000.01017.92
8.1.270.0080.00023.70
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0040.00422.18
8.1.230.0100.00021.10
8.1.220.0050.00318.04
8.1.210.0040.00418.88
8.1.200.0090.00017.38
8.1.190.0000.00817.51
8.1.180.0040.00818.10
8.1.170.0040.00718.75
8.1.160.0000.00921.98
8.1.150.0070.00018.77
8.1.140.0040.00417.57
8.1.130.0000.00717.82
8.1.120.0040.00417.59
8.1.110.0030.00517.54
8.1.100.0000.00817.62
8.1.90.0000.00817.54
8.1.80.0080.00017.59
8.1.70.0000.00717.50
8.1.60.0000.00717.73
8.1.50.0040.00417.67
8.1.40.0040.00417.48
8.1.30.0040.00417.73
8.1.20.0000.00717.82
8.1.10.0040.00417.78
8.1.00.0000.00817.64
8.0.300.0040.00420.22
8.0.290.0050.00317.18
8.0.280.0000.00718.43
8.0.270.0040.00417.39
8.0.260.0080.00017.23
8.0.250.0030.00317.19
8.0.240.0000.00617.05
8.0.230.0040.00417.10
8.0.220.0030.00316.93
8.0.210.0000.00817.01
8.0.200.0070.00016.99
8.0.190.0040.00417.06
8.0.180.0040.00416.89
8.0.170.0000.00816.97
8.0.160.0040.00416.93
8.0.150.0000.00717.04
8.0.140.0040.00416.88
8.0.130.0000.00513.47
8.0.120.0000.00816.89
8.0.110.0040.00416.96
8.0.100.0030.00617.00
8.0.90.0030.00516.91
8.0.80.0190.00316.95
8.0.70.0000.00717.09
8.0.60.0040.00417.00
8.0.50.0070.00017.06
8.0.30.0110.00817.51
8.0.20.0140.00617.42
8.0.10.0000.00716.99
8.0.00.0080.01016.80
7.4.330.0020.00215.00
7.4.320.0000.00716.80
7.4.300.0040.00416.71
7.4.290.0030.00316.78
7.4.280.0030.00716.78
7.4.270.0040.00416.83
7.4.260.0070.00016.74
7.4.250.0080.00016.61
7.4.240.0000.00716.79
7.4.230.0040.00416.60
7.4.220.0130.01316.82
7.4.210.0080.00916.77
7.4.200.0030.00316.86
7.4.190.0000.00816.84
7.4.160.0060.00916.63
7.4.150.0060.01217.40
7.4.140.0090.00917.86
7.4.130.0070.01016.76
7.4.120.0100.00716.66
7.4.110.0140.00316.84
7.4.100.0090.01116.56
7.4.90.0100.00716.64
7.4.80.0030.01519.39
7.4.70.0070.01016.77
7.4.60.0090.00816.82
7.4.50.0000.00416.67
7.4.40.0090.00622.77
7.4.30.0100.00716.44
7.4.00.0090.00815.07
7.3.330.0000.00513.28
7.3.320.0000.00613.18
7.3.310.0000.00816.34
7.3.300.0040.00416.41
7.3.290.0100.00316.37
7.3.280.0080.01116.43
7.3.270.0060.01217.40
7.3.260.0060.01416.50
7.3.250.0060.01116.61
7.3.240.0120.00916.45
7.3.230.0100.01316.39
7.3.210.0100.00716.50
7.3.200.0130.00719.39
7.3.190.0130.00316.50
7.3.180.0160.00016.61
7.3.170.0060.01016.38
7.3.160.0080.00816.55
7.3.120.0050.01214.81
7.3.110.0070.00715.14
7.3.100.0000.01414.90
7.3.90.0070.00615.08
7.3.80.0000.00914.99
7.3.70.0000.01014.80
7.3.60.0090.00614.59
7.3.50.0070.00714.81
7.3.40.0000.01415.05
7.3.30.0040.01114.99
7.3.20.0080.00816.57
7.3.10.0040.00816.80
7.3.00.0040.01216.70
7.2.330.0060.01216.71
7.2.320.0100.01316.63
7.2.310.0090.00816.97
7.2.300.0100.00716.71
7.2.290.0080.00916.91
7.2.250.0060.01115.41
7.2.240.0100.01015.18
7.2.230.0030.01315.14
7.2.220.0030.01015.41
7.2.210.0080.00815.02
7.2.200.0030.00615.05
7.2.190.0000.01615.36
7.2.180.0060.00315.16
7.2.170.0060.00615.36
7.2.60.0110.00316.79
7.2.00.0060.00919.55
7.1.330.0060.00616.01
7.1.320.0040.01115.86
7.1.310.0040.00415.82
7.1.300.0040.00815.89
7.1.290.0040.00715.82
7.1.280.0040.00816.06
7.1.270.0040.01115.86
7.1.260.0060.01015.87
7.1.200.0080.00015.80
7.1.100.0070.01018.10
7.1.70.0130.00317.36
7.1.60.0070.01117.42
7.1.50.0130.01017.03
7.1.00.0070.07022.32
7.0.200.0060.01016.76
7.0.140.0030.07021.97
7.0.100.0070.08319.96
7.0.90.0130.08019.89
7.0.80.0070.07320.16
7.0.70.0030.08319.93
7.0.60.0170.06319.91
7.0.50.0100.08320.19
7.0.40.0100.07720.07
7.0.30.0100.08320.08
7.0.20.0100.07320.11
7.0.10.0170.07720.10
7.0.00.0100.07020.14
5.6.280.0100.06721.04
5.6.250.0100.07720.58
5.6.240.0030.09020.60
5.6.230.0100.08020.48
5.6.220.0000.07020.63
5.6.210.0130.07020.65
5.6.200.0000.08321.14
5.6.190.0100.06021.00
5.6.180.0130.07721.11
5.6.170.0230.06720.95
5.6.160.0100.06720.96
5.6.150.0000.08321.06
5.6.140.0100.06020.93
5.6.130.0000.08720.93
5.6.120.0100.08321.05
5.6.110.0130.07021.04
5.6.100.0100.08321.16
5.6.90.0100.08021.08
5.6.80.0030.08320.41
5.6.70.0030.05720.48
5.6.60.0030.07720.40
5.6.50.0030.07720.43
5.6.40.0070.07720.42
5.6.30.0100.05320.41
5.6.20.0200.05020.46
5.6.10.0100.06720.45
5.6.00.0000.08320.35
5.5.380.0070.07020.35
5.5.370.0100.08020.38
5.5.360.0130.06320.54
5.5.350.0170.06020.43
5.5.340.0030.08320.89
5.5.330.0130.07720.94
5.5.320.0070.06320.77
5.5.310.0070.08320.81
5.5.300.0100.05020.89
5.5.290.0030.09020.91
5.5.280.0100.07720.91
5.5.270.0100.07720.82
5.5.260.0030.08320.88
5.5.250.0100.08720.55
5.5.240.0170.07020.21
5.5.230.0170.04019.99
5.5.220.0100.06720.20
5.5.210.0070.07720.25
5.5.200.0030.08320.19
5.5.190.0030.04720.21
5.5.180.0030.08320.25
5.5.160.0070.07320.28
5.5.150.0130.05320.28
5.5.140.0030.04320.15
5.5.130.0070.05320.22
5.5.120.0130.07020.14
5.5.110.0030.07720.21
5.5.100.0100.07020.08
5.5.90.0200.06020.07
5.5.80.0100.06320.18
5.5.70.0030.08020.06
5.5.60.0100.04720.03
5.5.50.0170.06020.10
5.5.40.0100.05720.07
5.5.30.0070.08020.15
5.5.20.0100.06019.95
5.5.10.0070.08319.96
5.5.00.0070.07720.04
5.4.450.0070.08019.45
5.4.440.0130.04319.39
5.4.430.0100.05719.44
5.4.420.0070.08019.35
5.4.410.0100.07019.23
5.4.400.0030.05019.04
5.4.390.0100.05018.79
5.4.380.0100.07018.97
5.4.370.0170.06319.06
5.4.360.0130.06319.13
5.4.350.0070.06719.04
5.4.340.0100.07019.04
5.4.320.0070.07319.12
5.4.310.0100.06719.08
5.4.300.0130.07019.04
5.4.290.0100.07718.94
5.4.280.0030.07318.81
5.4.270.0030.08019.22
5.4.260.0030.07318.97
5.4.250.0000.08019.12
5.4.240.0000.05718.95
5.4.230.0130.07019.02
5.4.220.0130.07719.09
5.4.210.0000.08719.06
5.4.200.0070.08018.96
5.4.190.0100.07019.11
5.4.180.0100.07718.80
5.4.170.0100.07318.96
5.4.160.0130.06719.12
5.4.150.0130.07318.95
5.4.140.0030.07716.35
5.4.130.0070.07016.44
5.4.120.0070.07316.42
5.4.110.0170.05316.47
5.4.100.0100.07016.29
5.4.90.0130.05316.32
5.4.80.0100.06016.26
5.4.70.0100.06716.32
5.4.60.0000.04016.18
5.4.50.0030.06316.37
5.4.40.0030.08016.39
5.4.30.0070.07016.21
5.4.20.0100.03716.36
5.4.10.0070.07016.20
5.4.00.0100.07015.62
5.3.290.0030.06714.66
5.3.280.0100.07314.58
5.3.270.0170.07014.60
5.3.260.0130.07014.45
5.3.250.0070.07014.47
5.3.240.0030.08014.60
5.3.230.0100.04014.46
5.3.220.0030.07314.52
5.3.210.0030.08014.57
5.3.200.0070.04314.53
5.3.190.0100.07314.57
5.3.180.0100.06714.44
5.3.170.0000.07714.56
5.3.160.0070.05014.48
5.3.150.0070.07014.55
5.3.140.0000.08014.50
5.3.130.0070.05014.55
5.3.120.0030.07314.55
5.3.110.0170.03714.37
5.3.100.0130.07014.04
5.3.90.0070.05013.86
5.3.80.0130.06713.96
5.3.70.0100.07313.88
5.3.60.0100.07013.98
5.3.50.0130.05313.80
5.3.40.0100.05013.86
5.3.30.0000.04013.78
5.3.20.0000.05313.51
5.3.10.0130.06013.51
5.3.00.0070.03313.49
5.2.170.0070.06011.68
5.2.160.0100.05711.68
5.2.150.0030.03011.68
5.2.140.0030.06311.68
5.2.130.0100.03711.68
5.2.120.0030.03311.68
5.2.110.0030.04011.68
5.2.100.0000.07011.68
5.2.90.0100.05711.68
5.2.80.0100.04011.68
5.2.70.0000.06711.68
5.2.60.0100.05711.68
5.2.50.0070.05311.68
5.2.40.0030.06011.68
5.2.30.0000.03311.68
5.2.20.0070.06011.68
5.2.10.0030.05011.68
5.2.00.0100.04711.68
5.1.60.0070.04311.68
5.1.50.0000.04711.68
5.1.40.0030.05311.68
5.1.30.0030.05011.68
5.1.20.0030.06011.68
5.1.10.0070.04711.68
5.1.00.0000.05011.68
5.0.50.0100.04011.68
5.0.40.0070.04011.68
5.0.30.0030.06711.68
5.0.20.0000.03011.68
5.0.10.0030.03311.68
5.0.00.0030.05011.68
4.4.90.0100.01311.68
4.4.80.0000.03711.68
4.4.70.0030.03011.68
4.4.60.0000.04011.68
4.4.50.0030.02711.68
4.4.40.0030.05011.68
4.4.30.0030.03311.68
4.4.20.0070.01711.68
4.4.10.0030.01711.68
4.4.00.0030.05011.68
4.3.110.0000.01711.68
4.3.100.0000.03011.68
4.3.90.0030.03311.68
4.3.80.0070.05011.68
4.3.70.0070.03011.68
4.3.60.0000.03711.68
4.3.50.0000.03311.68
4.3.40.0070.04711.68
4.3.30.0000.03711.68
4.3.20.0070.02711.68
4.3.10.0000.03711.68
4.3.00.0070.03011.68

preferences:
43.74 ms | 400 KiB | 5 Q