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); 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.0120.00620.99
8.3.40.0130.00318.84
8.3.30.0090.00918.92
8.3.20.0050.00220.25
8.3.10.0080.00023.52
8.3.00.0040.00419.50
8.2.180.0090.00918.41
8.2.170.0060.00922.96
8.2.160.0140.00720.55
8.2.150.0080.00024.18
8.2.140.0020.00524.66
8.2.130.0070.00026.16
8.2.120.0050.00222.11
8.2.110.0110.01122.37
8.2.100.0080.00417.91
8.2.90.0000.00819.13
8.2.80.0000.00817.97
8.2.70.0080.00417.63
8.2.60.0090.00217.80
8.2.50.0050.00518.07
8.2.40.0060.00319.76
8.2.30.0000.00819.72
8.2.20.0000.00817.76
8.2.10.0040.00418.02
8.2.00.0080.00317.75
8.1.280.0130.00725.92
8.1.270.0030.00623.83
8.1.260.0000.00926.35
8.1.250.0000.00828.09
8.1.240.0110.01123.79
8.1.230.0070.00419.09
8.1.220.0060.00317.74
8.1.210.0080.00018.77
8.1.200.0000.00917.36
8.1.190.0000.00817.50
8.1.180.0000.01019.13
8.1.170.0060.00618.66
8.1.160.0060.00321.98
8.1.150.0000.00718.68
8.1.140.0020.00517.52
8.1.130.0030.00317.85
8.1.120.0050.00317.45
8.1.110.0080.00017.52
8.1.100.0000.00817.55
8.1.90.0000.00717.59
8.1.80.0050.00217.43
8.1.70.0000.00717.52
8.1.60.0070.00017.68
8.1.50.0000.00817.56
8.1.40.0000.00817.50
8.1.30.0060.00317.71
8.1.20.0060.00317.68
8.1.10.0040.00417.51
8.1.00.0040.00417.54
8.0.300.0040.00419.03
8.0.290.0040.00417.05
8.0.280.0040.00418.28
8.0.270.0000.00717.09
8.0.260.0060.00017.29
8.0.250.0030.00316.95
8.0.240.0070.00017.02
8.0.230.0040.00417.05
8.0.220.0000.00716.98
8.0.210.0000.00816.89
8.0.200.0040.00416.91
8.0.190.0050.00217.08
8.0.180.0030.00617.01
8.0.170.0040.00416.93
8.0.160.0050.00316.81
8.0.150.0000.00716.91
8.0.140.0030.00516.95
8.0.130.0090.00013.45
8.0.120.0000.00816.97
8.0.110.0000.00716.96
8.0.100.0000.00716.88
8.0.90.0030.00316.93
8.0.80.0090.00616.88
8.0.70.0000.00716.87
8.0.60.0000.00817.04
8.0.50.0000.00716.84
8.0.30.0110.00817.10
8.0.20.0130.00617.40
8.0.10.0000.00717.17
8.0.00.0070.01316.72
7.4.330.0050.00015.00
7.4.320.0030.00316.64
7.4.300.0060.00016.55
7.4.290.0030.00716.64
7.4.280.0090.00016.65
7.4.270.0000.00716.78
7.4.260.0030.00316.74
7.4.250.0000.00816.72
7.4.240.0050.00216.74
7.4.230.0070.00016.78
7.4.220.0120.00616.68
7.4.210.0060.00916.73
7.4.200.0070.00016.84
7.4.190.0070.00016.91
7.4.160.0040.01216.70
7.4.150.0150.00317.40
7.4.140.0050.01217.86
7.4.130.0100.00716.67
7.4.120.0110.00616.65
7.4.110.0100.01016.72
7.4.100.0070.01416.52
7.4.90.0130.00316.58
7.4.80.0100.00719.39
7.4.70.0060.01016.53
7.4.60.0120.00616.51
7.4.50.0020.00216.68
7.4.40.0030.01222.77
7.4.30.0080.00816.54
7.4.00.0110.00715.23
7.3.330.0000.00613.02
7.3.320.0000.00513.22
7.3.310.0030.00316.22
7.3.300.0030.00316.29
7.3.290.0120.00816.30
7.3.280.0110.00816.27
7.3.270.0110.00717.40
7.3.260.0110.00516.80
7.3.250.0100.00716.33
7.3.240.0120.00816.55
7.3.230.0100.00716.55
7.3.210.0090.00916.26
7.3.200.0060.01219.39
7.3.190.0060.00916.40
7.3.180.0080.00816.20
7.3.170.0070.01016.27
7.3.160.0120.00316.62
7.3.120.0120.00315.06
7.3.00.0090.00616.76
7.2.330.0090.01116.47
7.2.320.0070.01016.38
7.2.310.0130.00416.59
7.2.300.0090.00816.76
7.2.290.0120.00316.57
7.2.130.0100.00616.96
7.2.120.0090.00616.61
7.2.110.0060.00616.72
7.2.100.0110.00516.66
7.2.90.0030.01116.70
7.2.80.0040.00716.68
7.2.70.0050.00816.90
7.2.60.0050.00416.78
7.2.50.0060.00416.89
7.2.40.0060.00616.87
7.2.30.0060.00417.01
7.2.20.0070.00716.93
7.2.10.0070.00716.86
7.2.00.0050.00817.75
7.1.250.0100.00316.07
7.1.240.0060.00915.95
7.1.230.0030.01015.80
7.1.220.0030.00715.91
7.1.210.0050.00615.82
7.1.200.0040.00715.88
7.1.190.0080.00315.75
7.1.180.0070.00315.82
7.1.170.0040.00615.79
7.1.160.0020.00915.77
7.1.150.0030.01015.96
7.1.140.0050.00815.63
7.1.130.0070.00415.74
7.1.120.0030.00815.96
7.1.110.0070.00415.66
7.1.100.0060.00616.62
7.1.90.0090.00515.83
7.1.80.0040.00615.77
7.1.70.0050.00716.33
7.1.60.0040.01017.11
7.1.50.0080.00516.25
7.1.40.0060.00816.06
7.1.30.0020.01016.00
7.1.20.0070.00715.94
7.1.10.0060.00415.94
7.1.00.0050.02817.97
7.0.330.0000.01015.37
7.0.320.0060.00615.30
7.0.310.0030.00915.59
7.0.300.0050.00315.25
7.0.290.0040.00615.21
7.0.280.0050.00515.25
7.0.270.0070.00215.40
7.0.260.0050.00715.58
7.0.250.0060.00515.71
7.0.240.0030.00615.42
7.0.230.0080.00715.37
7.0.220.0090.00515.54
7.0.210.0010.01015.57
7.0.200.0030.00715.89
7.0.190.0070.00515.45
7.0.180.0000.01215.35
7.0.170.0060.00515.33
7.0.160.0040.00715.45
7.0.150.0050.00615.47
7.0.140.0030.02917.65
7.0.130.0040.00815.69
7.0.120.0000.00915.52
7.0.110.0000.01215.35
7.0.100.0070.00315.66
7.0.90.0000.01115.46
7.0.80.0080.00215.66
7.0.70.0060.00515.45
7.0.60.0080.03016.88
7.0.50.0060.02816.36
7.0.40.0090.03015.83
7.0.30.0120.03215.75
7.0.20.0130.01815.76
7.0.10.0060.01715.63
7.0.00.0030.03515.72
5.6.380.0030.00914.26
5.6.370.0090.00314.39
5.6.360.0020.00914.25
5.6.350.0070.00514.10
5.6.340.0020.00914.26
5.6.330.0040.00814.36
5.6.320.0050.00514.23
5.6.310.0060.00614.17
5.6.300.0070.00514.34
5.6.290.0070.00414.29
5.6.280.0040.02716.46
5.6.270.0070.00514.24
5.6.260.0040.00614.40
5.6.250.0010.01014.26
5.6.240.0090.00414.13
5.6.230.0050.00714.36
5.6.220.0060.00514.29
5.6.210.0040.01716.29
5.6.200.0060.02315.53
5.6.190.0030.02316.25
5.6.180.0100.03016.29
5.6.170.0140.02916.32
5.6.160.0120.01416.44
5.6.150.0050.02715.58
5.6.140.0070.03215.50
5.6.130.0050.02215.49
5.6.120.0060.03416.54
5.6.110.0060.01916.33
5.6.100.0040.03216.41
5.6.90.0130.02716.62
5.6.80.0070.03116.17
5.6.70.1460.01616.17
5.6.60.0050.00914.05
5.6.50.0040.00814.22
5.6.40.0070.00214.07
5.6.30.0070.00714.00
5.6.20.0090.00314.41
5.6.10.0070.00714.24
5.6.00.0070.00714.07
5.5.380.0040.00911.22
5.5.370.0060.00211.12
5.5.360.0030.00411.19
5.5.350.0120.02114.21
5.5.340.0040.02213.45
5.5.330.0040.03114.33
5.5.320.0130.02014.16
5.5.310.0090.01714.36
5.5.300.0010.02513.42
5.5.290.0040.03113.42
5.5.280.0060.02314.38
5.5.270.0040.01714.35
5.5.260.0040.03114.43
5.5.250.0050.01514.23
5.5.240.0080.01414.20
5.5.230.0030.00511.12
5.5.220.0030.00411.04
5.5.210.0050.00611.08
5.5.200.0040.00510.96
5.5.190.0030.00511.16
5.5.180.0060.00311.13
5.5.170.0040.00612.45
5.5.160.0020.00711.10
5.5.150.0030.00711.02
5.5.140.0040.00511.16
5.5.130.0070.00311.13
5.5.120.0020.00611.16
5.5.110.0070.00311.19
5.5.100.0060.00411.13
5.5.90.0030.00511.12
5.5.80.0060.00211.07
5.5.70.0040.00610.98
5.5.60.0020.00811.18
5.5.50.0040.00711.10
5.5.40.0050.00511.08
5.5.30.0050.00511.13
5.5.20.0010.00611.06
5.5.10.0060.00311.10
5.5.00.0020.00810.96
5.4.450.0290.02313.79
5.4.440.0310.02313.75
5.4.430.0070.02113.91
5.4.420.0210.02113.90
5.4.410.0230.02313.75
5.4.400.0290.01813.77
5.4.390.0240.02413.77
5.4.380.0170.01913.52
5.4.370.0140.02013.56
5.4.360.0090.02313.62
5.4.350.0090.02513.65
5.4.340.0120.01913.61
5.4.330.0040.00310.97
5.4.320.0050.01711.45
5.4.310.0060.01611.63
5.4.300.0030.01611.61
5.4.290.0060.02111.58
5.4.280.0110.02711.50
5.4.270.0060.02811.50
5.4.260.0090.02411.53
5.4.250.0120.03711.41
5.4.240.0090.03211.57
5.4.230.0080.02711.48
5.4.220.0090.03811.54
5.4.210.0060.01711.51
5.4.200.0100.03311.46
5.4.190.0100.03311.52
5.4.180.0120.03011.54
5.4.170.0050.02211.46
5.4.160.0100.02411.48
5.4.150.0080.02011.58
5.4.140.0090.02711.47
5.4.130.0070.02311.46
5.4.120.0090.02711.39
5.4.110.0070.02511.47
5.4.100.0060.02811.36
5.4.90.0070.02211.39
5.4.80.0080.01911.41
5.4.70.0070.02411.31
5.4.60.0070.01411.36
5.4.50.0050.02011.26
5.4.40.0080.03211.40
5.4.30.0060.02011.39
5.4.20.0060.02111.39
5.4.10.0070.02111.40
5.4.00.0070.02911.25
5.3.290.0030.01811.54
5.3.280.0050.04311.45
5.3.270.0070.03011.48
5.3.260.0080.03511.49
5.3.250.0070.02011.48
5.3.240.0070.02911.45
5.3.230.0090.02711.45
5.3.220.0050.02111.44
5.3.210.0050.02411.44
5.3.200.0050.02011.46
5.3.190.0070.02011.47
5.3.180.0060.02011.41
5.3.170.0050.02411.44
5.3.160.0120.02311.49
5.3.150.0080.02111.50
5.3.140.0080.03911.49
5.3.130.0080.02811.47
5.3.120.0040.03111.44
5.3.110.0090.03411.47
5.3.100.0080.03411.16
5.3.90.0070.02211.20
5.3.80.0050.02211.15
5.3.70.0090.02711.21
5.3.60.0070.02111.18
5.3.50.0050.02211.18
5.3.40.0070.02911.18
5.3.30.0100.02411.18
5.3.20.0070.01711.02
5.3.10.0090.02611.05
5.3.00.0100.03010.99
5.2.170.0100.0259.99
5.2.160.0100.0289.94
5.2.150.0030.0289.98
5.2.140.0050.0209.95
5.2.130.0060.0329.89
5.2.120.0090.0229.94
5.2.110.0070.0249.87
5.2.100.0060.0209.93
5.2.90.0070.0189.92
5.2.80.0030.0219.91
5.2.70.0040.0269.91
5.2.60.0050.0209.78
5.2.50.0060.0209.77
5.2.40.0040.0149.89
5.2.30.0030.0159.82
5.2.20.0040.0159.85
5.2.10.0040.0159.75
5.2.00.0050.0239.72
5.1.60.0070.0209.43
5.1.50.0060.0189.42
5.1.40.0030.0179.42
5.1.30.0040.0179.54
5.1.20.0050.0159.54
5.1.10.0040.0129.45
5.1.00.0030.0159.46
5.0.50.0080.0208.94
5.0.40.0040.0128.90
5.0.30.0030.0208.83
5.0.20.0040.0168.83
5.0.10.0020.0128.82
5.0.00.0020.0158.82
4.4.90.0040.0138.33
4.4.80.0040.0198.32
4.4.70.0060.0148.32
4.4.60.0030.0148.33
4.4.50.0040.0138.33
4.4.40.0000.0318.31
4.4.30.0070.0288.33
4.4.20.0020.0118.36
4.4.10.0030.0188.36
4.4.00.0020.0128.33
4.3.110.0050.0108.29
4.3.100.0030.0118.29
4.3.90.0050.0118.29
4.3.80.0020.0158.27
4.3.70.0010.0118.28
4.3.60.0010.0108.28
4.3.50.0030.0098.28
4.3.40.0040.0108.25
4.3.30.0010.0087.83
4.3.20.0020.0107.83
4.3.10.0020.0077.81
4.3.00.0010.00710.25

preferences:
42.29 ms | 401 KiB | 5 Q