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_NO_EMPTY); 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.0090.00616.50
8.3.50.0090.00921.30
8.3.40.0110.00718.80
8.3.30.0120.00319.04
8.3.20.0040.00420.34
8.3.10.0000.00823.67
8.3.00.0060.00619.35
8.2.180.0150.00018.06
8.2.170.0110.01122.96
8.2.160.0100.00320.37
8.2.150.0000.00724.18
8.2.140.0000.00724.66
8.2.130.0100.00326.16
8.2.120.0070.00022.25
8.2.110.0170.00322.08
8.2.100.0090.00317.78
8.2.90.0080.00019.08
8.2.80.0040.00417.97
8.2.70.0090.00017.75
8.2.60.0070.00417.91
8.2.50.0060.00318.07
8.2.40.0080.00019.95
8.2.30.0040.00419.73
8.2.20.0030.00617.81
8.2.10.0040.00418.13
8.2.00.0030.00717.83
8.1.280.0070.01425.92
8.1.270.0050.00323.83
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0170.00323.76
8.1.230.0070.00419.10
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0040.00417.35
8.1.190.0080.00017.30
8.1.180.0050.00418.10
8.1.170.0100.00018.58
8.1.160.0070.00422.04
8.1.150.0050.00318.65
8.1.140.0050.00217.55
8.1.130.0070.00017.71
8.1.120.0030.00517.53
8.1.110.0040.00417.62
8.1.100.0040.00417.56
8.1.90.0050.00217.52
8.1.80.0040.00417.55
8.1.70.0070.00017.51
8.1.60.0050.00517.67
8.1.50.0000.00817.56
8.1.40.0040.00417.62
8.1.30.0000.00817.69
8.1.20.0030.00617.70
8.1.10.0000.00817.59
8.1.00.0020.00517.51
8.0.300.0060.00319.21
8.0.290.0030.00617.16
8.0.280.0080.00018.30
8.0.270.0070.00017.15
8.0.260.0030.00317.13
8.0.250.0030.00317.04
8.0.240.0070.00017.09
8.0.230.0060.00316.93
8.0.220.0000.00716.92
8.0.210.0040.00416.88
8.0.200.0030.00316.93
8.0.190.0000.00817.04
8.0.180.0000.00717.02
8.0.170.0050.00216.91
8.0.160.0070.00017.01
8.0.150.0000.00716.82
8.0.140.0070.00016.84
8.0.130.0070.00013.37
8.0.120.0040.00416.81
8.0.110.0040.00417.00
8.0.100.0070.00016.88
8.0.90.0040.00417.00
8.0.80.0150.00616.97
8.0.70.0000.00716.98
8.0.60.0040.00416.94
8.0.50.0000.00716.86
8.0.30.0110.01417.08
8.0.20.0140.00617.40
8.0.10.0040.00417.16
8.0.00.0090.00816.85
7.4.330.0020.00215.05
7.4.320.0000.00616.65
7.4.300.0030.00316.61
7.4.290.0040.00416.70
7.4.280.0000.00716.59
7.4.270.0030.00316.52
7.4.260.0050.00216.64
7.4.250.0000.00816.62
7.4.240.0030.00516.74
7.4.230.0040.00416.78
7.4.220.0070.01116.61
7.4.210.0070.00816.71
7.4.200.0070.00016.50
7.4.190.0000.00716.90
7.4.160.0160.00616.68
7.4.150.0140.00417.40
7.4.140.0100.00817.86
7.4.130.0110.01316.66
7.4.120.0100.00716.53
7.4.110.0030.01416.55
7.4.100.0170.00916.53
7.4.90.0090.01216.70
7.4.80.0090.00619.39
7.4.70.0080.00916.61
7.4.60.0030.01416.57
7.4.50.0040.00416.49
7.4.40.0060.00622.77
7.4.30.0130.00316.65
7.4.10.0060.00614.95
7.4.00.0060.01014.99
7.3.330.0060.00013.20
7.3.320.0060.00013.00
7.3.310.0040.00416.30
7.3.300.0000.00716.30
7.3.290.0080.01216.41
7.3.280.0080.00816.26
7.3.270.0100.00717.40
7.3.260.0150.00316.82
7.3.250.0130.00416.51
7.3.240.0180.00616.31
7.3.230.0140.00316.39
7.3.210.0130.00416.54
7.3.200.0130.01019.39
7.3.190.0060.01016.50
7.3.180.0060.01516.61
7.3.170.0120.00916.27
7.3.160.0120.00316.34
7.3.130.0100.00714.73
7.3.120.0070.00914.81
7.3.110.0130.00514.85
7.3.100.0110.00614.92
7.3.90.0040.01114.99
7.3.80.0060.00714.67
7.3.70.0080.00614.87
7.3.60.0070.00714.85
7.3.50.0060.00714.87
7.3.40.0050.00814.74
7.3.30.0080.00514.66
7.3.20.0060.00916.72
7.3.10.0080.00716.74
7.3.00.0050.00816.64
7.2.330.0090.00916.56
7.2.320.0040.01516.71
7.2.310.0090.00916.54
7.2.300.0120.00616.75
7.2.290.0080.00916.83
7.2.260.0130.00315.07
7.2.250.0100.00814.92
7.2.240.0070.00815.09
7.2.230.0020.01615.09
7.2.220.0030.01115.07
7.2.210.0070.00615.02
7.2.200.0030.01115.13
7.2.190.0050.01015.09
7.2.180.0040.00715.07
7.2.170.0050.01014.96
7.2.160.0070.01015.14
7.2.150.0060.01016.88
7.2.140.0100.00316.79
7.2.130.0100.00517.01
7.2.120.0100.00516.96
7.2.110.0080.00816.94
7.2.100.0040.00616.81
7.2.90.0050.01016.99
7.2.80.0020.00916.90
7.2.70.0060.00916.84
7.2.60.0070.00716.97
7.2.50.0080.00316.97
7.2.40.0050.00916.85
7.2.30.0080.00617.00
7.2.20.0070.00416.71
7.2.10.0060.00816.97
7.2.00.0030.01116.84
7.1.330.0030.00815.91
7.1.320.0030.00915.96
7.1.310.0020.01016.01
7.1.300.0040.00615.85
7.1.290.0060.00615.76
7.1.280.0050.00515.88
7.1.270.0050.01015.85
7.1.260.0020.01115.96
7.1.250.0070.00516.07
7.1.240.0000.01415.97
7.1.230.0070.00715.75
7.1.220.0060.00615.83
7.1.210.0040.01115.79
7.1.200.0000.01116.01
7.1.190.0080.00815.81
7.1.180.0000.01315.95
7.1.170.0100.00315.68
7.1.160.0120.00315.91
7.1.150.0030.01215.91
7.1.140.0000.01215.70
7.1.130.0060.00315.87
7.1.120.0030.01016.04
7.1.110.0040.00416.00
7.1.100.0070.00715.72
7.1.90.0030.00715.81
7.1.80.0000.01016.01
7.1.70.0070.00816.47
7.1.60.0090.00717.74
7.1.50.0050.01316.32
7.1.40.0100.00715.95
7.1.30.0060.00616.02
7.1.20.0040.01115.86
7.1.10.0030.01316.00
7.1.00.0050.04219.22
7.0.330.0060.00615.26
7.0.320.0040.00415.48
7.0.310.0100.00315.49
7.0.300.0070.00415.48
7.0.290.0040.01215.70
7.0.280.0030.01015.35
7.0.270.0030.00815.53
7.0.260.0090.00615.64
7.0.250.0090.00615.55
7.0.240.0100.00315.64
7.0.230.0040.00715.46
7.0.220.0060.00615.51
7.0.210.0110.00315.68
7.0.200.0020.00816.30
7.0.190.0040.01115.72
7.0.180.0030.01315.35
7.0.170.0060.00615.44
7.0.160.0040.00715.44
7.0.150.0060.00815.14
7.0.140.0000.04618.75
7.0.130.0030.00615.34
7.0.120.0000.01015.35
7.0.110.0040.00815.44
7.0.100.0080.00315.60
7.0.90.0040.01115.61
7.0.80.0040.00715.62
7.0.70.0030.01215.65
7.0.60.0060.04817.71
7.0.50.0080.03716.84
7.0.40.0070.04716.92
7.0.30.0160.02716.79
7.0.20.0150.04316.75
7.0.10.0100.04316.81
7.0.00.0050.04816.85
5.6.400.0090.00314.52
5.6.390.0050.00514.13
5.6.380.0030.01014.32
5.6.370.0060.00614.46
5.6.360.0000.00813.99
5.6.350.0090.00614.26
5.6.340.0000.01114.15
5.6.330.0070.00314.63
5.6.320.0110.00314.07
5.6.310.0090.00314.46
5.6.300.0060.00614.38
5.6.290.0110.00314.34
5.6.280.0080.03717.76
5.6.270.0030.00714.34
5.6.260.0170.00013.91
5.6.250.0030.01013.96
5.6.240.0070.00714.10
5.6.230.0040.00814.01
5.6.220.0120.00414.26
5.6.210.0080.03017.42
5.6.200.0020.02516.24
5.6.190.0050.02817.40
5.6.180.0200.02417.58
5.6.170.0150.03717.33
5.6.160.0090.02717.46
5.6.150.0070.04116.31
5.6.140.0100.03516.11
5.6.130.0050.03816.21
5.6.120.0030.03717.66
5.6.110.0120.03817.74
5.6.100.0070.03517.56
5.6.90.0120.03817.69
5.6.80.0070.02217.26
5.6.70.0000.01213.95
5.6.60.0070.00714.36
5.6.50.0070.00414.05
5.6.40.0030.01014.39
5.6.30.0030.00514.01
5.6.20.0040.00714.19
5.6.10.0030.01014.30
5.6.00.0100.00714.24
5.5.380.0000.01014.20
5.5.370.0110.00014.40
5.5.360.0040.01114.18
5.5.350.0150.04417.21
5.5.340.0110.03415.91
5.5.330.0000.02917.13
5.5.320.0140.03517.09
5.5.310.0230.03817.19
5.5.300.0050.04615.90
5.5.290.0080.04116.00
5.5.280.0080.03017.57
5.5.270.0060.04117.29
5.5.260.0070.03717.32
5.5.250.0050.04917.37
5.5.240.0070.04217.14
5.5.230.0070.00714.24
5.5.220.0030.01014.14
5.5.210.0080.00414.23
5.5.200.0000.01013.86
5.5.190.0030.00614.22
5.5.180.0140.00314.00
5.5.170.0070.00413.96
5.5.160.0000.01514.17
5.5.150.0040.00814.18
5.5.140.0060.00914.05
5.5.130.0080.00414.14
5.5.120.0070.00713.72
5.5.110.0040.00713.92
5.5.100.0090.00314.20
5.5.90.0040.01114.06
5.5.80.0060.00914.35
5.5.70.0000.00913.82
5.5.60.0060.00613.75
5.5.50.0090.00614.04
5.5.40.0040.01114.05
5.5.30.0030.00714.18
5.5.20.0070.01013.88
5.5.10.0060.01014.17
5.5.00.0080.00414.18
5.4.450.0400.02515.81
5.4.440.0200.02615.95
5.4.430.0200.02015.81
5.4.420.0240.01615.86
5.4.410.0330.02515.91
5.4.400.0590.01515.79
5.4.390.0400.02415.66
5.4.380.0170.03315.53
5.4.370.0170.03115.60
5.4.360.0160.02515.61
5.4.350.0170.03015.61
5.4.340.0240.03915.63
5.4.330.0000.00812.43
5.4.320.0040.02212.46
5.4.310.0060.02212.46
5.4.300.0070.01912.46
5.4.290.0110.03812.45
5.4.280.0120.04112.40
5.4.270.0100.04312.40
5.4.260.0110.03812.40
5.4.250.0140.04612.40
5.4.240.0120.04812.40
5.4.230.0090.05212.39
5.4.220.0080.04112.39
5.4.210.0070.03712.39
5.4.200.0140.03612.40
5.4.190.0120.04412.39
5.4.180.0060.04812.39
5.4.170.0060.02812.40
5.4.160.0090.04312.40
5.4.150.0070.04012.40
5.4.140.0120.03612.24
5.4.130.0140.03912.23
5.4.120.0130.04812.21
5.4.110.0120.04012.21
5.4.100.0130.04012.21
5.4.90.0070.05312.21
5.4.80.0150.04812.21
5.4.70.0100.02812.21
5.4.60.0040.03312.21
5.4.50.0060.04512.21
5.4.40.0110.04112.20
5.4.30.0080.04212.20
5.4.20.0110.03612.20
5.4.10.0100.05512.20
5.4.00.0120.04911.95
5.3.290.0050.02112.62
5.3.280.0120.04312.57
5.3.270.0080.03312.58
5.3.260.0100.02912.57
5.3.250.0040.02912.58
5.3.240.0070.02612.57
5.3.230.0080.03412.57
5.3.220.0190.05512.56
5.3.210.0040.03312.55
5.3.200.0050.03112.55
5.3.190.0090.05112.55
5.3.180.0100.04512.55
5.3.170.0140.03812.55
5.3.160.0110.03812.55
5.3.150.0110.04512.55
5.3.140.0130.04012.54
5.3.130.0100.04512.54
5.3.120.0080.04212.54
5.3.110.0170.03712.54
5.3.100.0070.04112.28
5.3.90.0190.06012.27
5.3.80.0100.03712.26
5.3.70.0070.05412.26
5.3.60.0070.03112.25
5.3.50.0070.04012.22
5.3.40.0040.03312.22
5.3.30.0090.03812.21
5.3.20.0110.04212.09
5.3.10.0060.05112.08
5.3.00.0080.04412.07
5.2.170.0150.0659.22
5.2.160.0150.0759.21
5.2.150.0140.0579.22
5.2.140.0150.0509.21
5.2.130.0060.0669.17
5.2.120.0080.0709.17
5.2.110.0120.0739.18
5.2.100.0170.0789.18
5.2.90.0070.0529.18
5.2.80.0100.0549.17
5.2.70.0060.0569.17
5.2.60.0060.0519.13
5.2.50.0150.0499.09
5.2.40.0120.0479.07
5.2.30.0070.0479.06
5.2.20.0080.0509.04
5.2.10.0130.0648.93
5.2.00.0100.0698.79
5.1.60.0120.0608.06
5.1.50.0070.0608.06
5.1.40.0100.0358.04
5.1.30.0070.0728.39
5.1.20.0090.0478.41
5.1.10.0130.0658.14
5.1.00.0150.0478.14
5.0.50.0150.0406.61
5.0.40.0120.0416.48
5.0.30.0060.0686.29
5.0.20.0190.0396.26
5.0.10.0050.0326.24
5.0.00.0110.0676.23
4.4.90.0080.0424.78
4.4.80.0280.0784.76
4.4.70.0080.0424.76
4.4.60.0090.0944.75
4.4.50.0040.0244.77
4.4.40.0050.0384.70
4.4.30.0060.0234.75
4.4.20.0040.0274.84
4.4.10.0040.0264.85
4.4.00.0080.0694.76
4.3.110.0080.0454.67
4.3.100.0180.0354.66
4.3.90.0130.0384.63
4.3.80.0100.0514.58
4.3.70.0060.0384.63
4.3.60.0070.0504.63
4.3.50.0050.0324.63
4.3.40.0090.0594.54
4.3.30.0090.0363.29
4.3.20.0040.0253.26
4.3.10.0070.0213.22
4.3.00.0000.01713.17

preferences:
65.19 ms | 401 KiB | 5 Q