3v4l.org

run code in 300+ PHP versions simultaneously
<?php function htmlWrapThing($str, $size){ $html = false; $i = 0; $chars = str_split($str); $return = ""; $break = false; $tag = ""; foreach($chars as $char){ if($char=="<") $html = true; if($char==">") $html = false; if(!$html) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $break = false; } if($html) $t++; if($html && $char=="/"){ $tag = ""; }elseif($html && $char!="/" && $t > 1){ $tag .= $char; } } return $return; } $str = "<h1>hilo everybody how is everyone doing tonight?</h1><p>hello world how is everyone doing today</p><p>hello world how is everyone doing today</p><p>hello world how is everyone doing today</p><br><br />hello everybody how are you doing today?"; echo htmlWrapThing($str,10);

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.0110.00418.68
8.3.50.0210.00221.25
8.3.40.0040.01418.98
8.3.30.0070.00719.21
8.3.20.0040.00420.16
8.3.10.0090.00023.44
8.3.00.0040.00419.26
8.2.180.0140.00017.00
8.2.170.0120.00622.96
8.2.160.0110.00420.21
8.2.150.0080.00624.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0000.00821.01
8.2.110.0030.00622.01
8.2.100.0120.00017.88
8.2.90.0040.00419.35
8.2.80.0030.00517.97
8.2.70.0090.00017.63
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0060.00318.34
8.2.30.0040.00418.04
8.2.20.0000.00717.84
8.2.10.0000.00718.19
8.2.00.0050.00317.85
8.1.280.0090.00925.92
8.1.270.0040.00422.25
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00323.92
8.1.230.0040.00819.20
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00617.35
8.1.190.0030.00617.13
8.1.180.0000.00818.10
8.1.170.0040.00418.49
8.1.160.0080.00021.98
8.1.150.0070.00018.92
8.1.140.0080.00017.39
8.1.130.0070.00017.77
8.1.120.0040.00417.48
8.1.110.0000.00717.48
8.1.100.0040.00417.50
8.1.90.0000.00717.51
8.1.80.0000.00717.50
8.1.70.0050.00217.35
8.1.60.0140.00017.57
8.1.50.0040.00417.59
8.1.40.0050.00317.49
8.1.30.0040.00417.61
8.1.20.0000.00717.75
8.1.10.0000.00717.53
8.1.00.0040.00417.37
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.42
8.0.270.0000.00717.27
8.0.260.0060.00017.18
8.0.250.0030.00317.09
8.0.240.0030.00617.10
8.0.230.0030.00316.95
8.0.220.0000.00717.01
8.0.210.0000.00716.90
8.0.200.0060.00017.05
8.0.190.0000.00816.98
8.0.180.0000.00817.04
8.0.170.0080.00016.98
8.0.160.0000.00716.89
8.0.150.0040.00416.89
8.0.140.0070.00016.97
8.0.130.0060.00013.46
8.0.120.0040.00416.93
8.0.110.0000.00816.82
8.0.100.0050.00316.93
8.0.90.0050.00316.88
8.0.80.0070.01016.98
8.0.70.0000.00816.93
8.0.60.0000.00816.84
8.0.50.0040.00417.02
8.0.30.0160.00717.13
8.0.20.0090.00917.40
8.0.10.0070.00017.07
8.0.00.0160.00216.94
7.4.330.0050.00015.02
7.4.320.0060.00016.63
7.4.300.0000.00716.68
7.4.290.0040.00416.68
7.4.280.0090.00016.43
7.4.270.0030.00316.55
7.4.260.0000.00716.52
7.4.250.0040.00416.44
7.4.240.0030.00416.61
7.4.230.0070.00016.69
7.4.220.0130.01316.66
7.4.210.0100.00616.45
7.4.200.0000.00716.42
7.4.160.0120.01216.61
7.4.150.0140.00417.40
7.4.140.0080.01417.86
7.4.130.0100.00816.56
7.4.120.0100.00716.68
7.4.110.0100.00716.54
7.4.100.0070.01016.58
7.4.90.0090.00916.47
7.4.80.0120.00919.39
7.4.70.0070.01116.68
7.4.60.0090.00616.61
7.4.50.0000.00716.71
7.4.40.0060.01016.48
7.4.30.0150.00616.61
7.4.00.0110.00415.25
7.3.330.0030.00313.39
7.3.320.0050.00013.43
7.3.310.0000.00716.50
7.3.300.0030.00616.32
7.3.290.0060.00816.47
7.3.280.0120.00816.49
7.3.270.0070.01017.40
7.3.260.0060.01216.47
7.3.250.0140.00516.53
7.3.240.0090.01516.36
7.3.230.0080.00816.47
7.3.210.0090.00916.52
7.3.200.0090.00919.39
7.3.190.0050.01116.45
7.3.180.0120.00416.44
7.3.170.0070.01016.49
7.3.160.0040.01216.47
7.2.330.0150.00916.54
7.2.320.0080.01616.82
7.2.310.0040.01516.80
7.2.300.0060.01116.73
7.2.290.0070.01516.79
7.2.80.0040.01116.32
7.2.00.0080.01219.41
7.1.200.0040.00815.89
7.1.100.0150.00018.40
7.1.70.0000.00817.19
7.1.60.0070.01819.32
7.1.50.0060.01916.85
7.1.00.0100.06722.46
7.0.200.0000.00916.44
7.0.140.0100.06722.21
7.0.60.0000.06719.87
7.0.50.0030.04317.92
7.0.40.0100.08020.20
7.0.30.0300.04020.26
7.0.20.0300.07320.16
7.0.10.0170.08020.16
7.0.00.0030.04320.22
5.6.280.0000.07721.02
5.6.210.0170.07720.56
5.6.200.0100.08318.25
5.6.190.0100.05020.61
5.6.180.0170.08020.77
5.6.170.0430.07320.47
5.6.160.0070.08020.54
5.6.150.0030.05318.25
5.6.140.0030.04718.16
5.6.130.0100.03318.14
5.6.120.0030.08321.16
5.6.110.0070.07721.15
5.6.100.0100.08021.08
5.6.90.0100.07321.01
5.6.80.0130.07020.39
5.5.350.0330.07320.46
5.5.340.0030.04717.98
5.5.330.0070.08320.21
5.5.320.0270.03720.47
5.5.310.0200.08720.32
5.5.300.0070.07318.08
5.5.290.0000.04717.95
5.5.280.0070.08020.69
5.5.270.0000.06321.00
5.5.260.0030.04320.76
5.5.250.0070.08320.53
5.5.240.4470.04720.30
5.4.450.0570.07019.39
5.4.440.0500.07019.39
5.4.430.0730.06319.57
5.4.420.0870.04719.60
5.4.410.0730.07719.34
5.4.400.0900.06019.23
5.4.390.0530.07019.16
5.4.380.0670.05718.99
5.4.370.0330.04318.97
5.4.360.0830.05319.25
5.4.350.0700.06319.25
5.4.340.0080.04012.05
5.4.320.0070.0298.33
5.4.310.0080.04112.54
5.4.300.0110.04312.54
5.4.290.0090.04012.54
5.4.280.0090.03512.44
5.4.270.0040.04112.44
5.4.260.0090.04412.44
5.4.250.0100.05112.43
5.4.240.0050.04312.44
5.4.230.0060.04612.43
5.4.220.0040.05312.43
5.4.210.0100.04712.43
5.4.200.0090.04612.43
5.4.190.0100.04712.42
5.4.180.0080.03912.43
5.4.170.0080.04012.43
5.4.160.0080.04312.43
5.4.150.0090.03912.42
5.4.140.0070.04612.11
5.4.130.0090.03812.10
5.4.120.0110.04412.06
5.4.110.0090.06012.05
5.4.100.0100.03512.05
5.4.90.0090.04112.05
5.4.80.0090.04712.05
5.4.70.0060.04012.05
5.4.60.0040.04012.04
5.4.50.0080.03912.05
5.4.40.0080.03812.04
5.4.30.0060.03712.04
5.4.20.0060.04112.03
5.4.10.0060.04012.04
5.4.00.0080.04011.52
5.3.290.0070.04212.80
5.3.280.0070.04212.71
5.3.270.0040.05012.72
5.3.260.0090.04012.73
5.3.250.0050.04112.72
5.3.240.0070.04012.72
5.3.230.0090.03612.72
5.3.220.0040.04112.68
5.3.210.0090.04912.68
5.3.200.0040.04612.68
5.3.190.0060.04412.69
5.3.180.0070.03512.68
5.3.170.0090.04112.68
5.3.160.0060.04812.68
5.3.150.0070.04612.68
5.3.140.0070.04812.68
5.3.130.0090.05112.67
5.3.120.0060.05012.67
5.3.110.0100.03812.67
5.3.100.0060.04112.16
5.3.90.0070.03912.14
5.3.80.0080.04612.13
5.3.70.0080.04812.13
5.3.60.0070.05112.11
5.3.50.0080.04112.06
5.3.40.0070.04412.06
5.3.30.0040.05012.02
5.3.20.0080.03911.80
5.3.10.0080.04611.77
5.3.00.0070.04411.75
5.2.170.0080.0329.26
5.2.160.0060.0289.26
5.2.150.0050.0309.25
5.2.140.0060.0289.25
5.2.130.0020.0319.21
5.2.120.0070.0279.21
5.2.110.0060.0289.22
5.2.100.0040.0309.21
5.2.90.0090.0319.21
5.2.80.0090.0379.21
5.2.70.0050.0409.21
5.2.60.0050.0419.17
5.2.50.0070.0399.14
5.2.40.0060.0389.11
5.2.30.0060.0409.09
5.2.20.0090.0349.07
5.2.10.0090.0358.98
5.2.00.0050.0408.85
5.1.60.0070.0308.14
5.1.50.0070.0328.13
5.1.40.0050.0338.11
5.1.30.0040.0358.47
5.1.20.0100.0338.49
5.1.10.0090.0298.21
5.1.00.0090.0308.21
5.0.50.0060.0266.70
5.0.40.0060.0286.55
5.0.30.0040.0586.37
5.0.20.0060.0196.34
5.0.10.0050.0236.31
5.0.00.0020.0346.32
4.4.90.0030.0164.77
4.4.80.0030.0184.76
4.4.70.0030.0164.75
4.4.60.0040.0154.75
4.4.50.0030.0164.77
4.4.40.0030.0274.71
4.4.30.0030.0164.76
4.4.20.0010.0184.84
4.4.10.0020.0174.85
4.4.00.0010.0284.76
4.3.110.0030.0174.67
4.3.100.0030.0244.66
4.3.90.0020.0184.63
4.3.80.0040.0294.58
4.3.70.0020.0194.63
4.3.60.0010.0174.63
4.3.50.0040.0154.63
4.3.40.0050.0234.54
4.3.30.0040.0153.32
4.3.20.0050.0143.30
4.3.10.0010.0173.26
4.3.00.0100.0236.80

preferences:
42.58 ms | 401 KiB | 5 Q