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) $t++; if($html && $char!="/" && $t > 1){ $tag .= $char; } if(!$html) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ if($oldtag != $tag){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $tag = ""; }else{ $return .= '</'.$oldtag.'>'."<br><br>".'<'.$oldtag.'>'; $i=0; } $break = false; } $oldtag = $tag; } 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.0100.00618.55
8.3.50.0110.01022.04
8.3.40.0090.00618.69
8.3.30.0070.00719.22
8.3.20.0040.00420.25
8.3.10.0040.01123.54
8.3.00.0000.00819.38
8.2.180.0130.00318.29
8.2.170.0070.00722.96
8.2.160.0110.00420.33
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0050.00226.16
8.2.120.0000.00720.98
8.2.110.0040.00722.13
8.2.100.0080.00417.63
8.2.90.0030.00519.18
8.2.80.0040.00417.97
8.2.70.0070.00417.63
8.2.60.0060.00317.79
8.2.50.0000.00818.07
8.2.40.0060.00318.22
8.2.30.0040.00418.17
8.2.20.0000.00817.91
8.2.10.0050.00318.23
8.2.00.0030.00517.80
8.1.280.0040.01125.92
8.1.270.0040.00423.89
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0090.00023.93
8.1.230.0060.00619.10
8.1.220.0080.00017.74
8.1.210.0090.00018.77
8.1.200.0040.00417.47
8.1.190.0030.00517.48
8.1.180.0050.00318.10
8.1.170.0000.00918.82
8.1.160.0000.00822.03
8.1.150.0070.00018.99
8.1.140.0040.00417.52
8.1.130.0030.00317.81
8.1.120.0040.00417.46
8.1.110.0000.00717.42
8.1.100.0070.00017.50
8.1.90.0040.00417.46
8.1.80.0000.00717.56
8.1.70.0000.00717.54
8.1.60.0030.00617.64
8.1.50.0030.00617.47
8.1.40.0000.00817.59
8.1.30.0040.00417.68
8.1.20.0080.00017.60
8.1.10.0000.00717.48
8.1.00.0040.00417.43
8.0.300.0070.00018.77
8.0.290.0050.00217.00
8.0.280.0070.00018.39
8.0.270.0000.00717.34
8.0.260.0050.00317.24
8.0.250.0030.00317.09
8.0.240.0000.00717.13
8.0.230.0000.00717.09
8.0.220.0040.00417.01
8.0.210.0000.00717.02
8.0.200.0070.00017.07
8.0.190.0030.00517.04
8.0.180.0000.00717.02
8.0.170.0050.00316.93
8.0.160.0070.00017.09
8.0.150.0040.00416.84
8.0.140.0000.00816.97
8.0.130.0000.00513.38
8.0.120.0080.00017.00
8.0.110.0000.00817.01
8.0.100.0070.00017.05
8.0.90.0000.00717.09
8.0.80.0040.01216.97
8.0.70.0030.00516.94
8.0.60.0040.00417.14
8.0.50.0050.00317.05
8.0.30.0100.01217.27
8.0.20.0130.00617.40
8.0.10.0040.00417.11
8.0.00.0090.01416.85
7.4.330.0020.00215.02
7.4.320.0030.00316.57
7.4.300.0000.00716.57
7.4.290.0000.00716.69
7.4.280.0000.00916.64
7.4.270.0000.00616.59
7.4.260.0080.00016.50
7.4.250.0040.00416.55
7.4.240.0050.00316.66
7.4.230.0030.00316.42
7.4.220.0070.01016.51
7.4.210.0120.00316.62
7.4.200.0030.00316.46
7.4.160.0070.01016.72
7.4.150.0110.00817.40
7.4.140.0070.01317.86
7.4.130.0110.00616.67
7.4.120.0090.01116.58
7.4.110.0070.01016.67
7.4.100.0050.01416.65
7.4.90.0040.01516.72
7.4.80.0110.00819.39
7.4.70.0060.01216.65
7.4.60.0110.00716.66
7.4.50.0000.00516.52
7.4.40.0060.00916.76
7.4.30.0150.00616.36
7.4.00.0110.00715.24
7.3.330.0050.00013.36
7.3.320.0030.00313.45
7.3.310.0000.00816.53
7.3.300.0000.00716.48
7.3.290.0070.00916.50
7.3.280.0090.00816.46
7.3.270.0100.00717.40
7.3.260.0130.01016.56
7.3.250.0100.01216.65
7.3.240.0140.00316.58
7.3.230.0100.00716.39
7.3.210.0030.01316.48
7.3.200.0100.00719.39
7.3.190.0040.01416.70
7.3.180.0060.01216.80
7.3.170.0120.01116.62
7.3.160.0100.00716.73
7.2.330.0070.01016.75
7.2.320.0090.00916.84
7.2.310.0090.00916.84
7.2.300.0050.01116.47
7.2.290.0100.01416.63
7.2.60.0150.01116.30
7.1.200.0070.00715.94
7.1.100.0040.00718.19
7.1.70.0020.00516.93
7.1.60.0060.01319.32
7.1.50.0140.01017.01
7.1.00.0100.07022.36
7.0.200.0040.00416.93
7.0.140.0030.07021.95
7.0.60.0070.09019.88
7.0.50.0070.04017.93
7.0.40.0100.08320.13
7.0.30.0330.06720.23
7.0.20.0170.06320.13
7.0.10.0030.04320.24
7.0.00.0070.08020.23
5.6.280.0070.07021.14
5.6.210.0130.07020.68
5.6.200.0070.03718.15
5.6.190.0070.08320.61
5.6.180.0170.08020.46
5.6.170.0400.07020.64
5.6.160.0000.06320.55
5.6.150.0170.04718.20
5.6.140.0030.05318.29
5.6.130.0070.08018.14
5.6.120.0170.06721.19
5.6.110.0130.08320.90
5.6.100.0030.04021.08
5.6.90.0130.04321.16
5.6.80.0100.06720.52
5.6.70.4400.03720.37
5.5.350.0270.07720.38
5.5.340.0030.05717.96
5.5.330.0100.04020.26
5.5.320.0330.03720.32
5.5.310.0230.04720.32
5.5.300.0170.07017.97
5.5.290.0100.05718.02
5.5.280.0030.04320.91
5.5.270.0100.07720.93
5.5.260.0070.07720.88
5.5.250.0170.07720.55
5.5.240.4030.04020.30
5.4.450.0830.08019.59
5.4.440.1130.06019.48
5.4.430.0930.06019.34
5.4.420.1030.06719.30
5.4.410.0830.05319.35
5.4.400.1000.05719.02
5.4.390.0830.05719.15
5.4.380.0700.05719.38
5.4.370.0370.05318.84
5.4.360.0930.07319.15
5.4.350.0870.05318.87
5.4.340.0050.03512.06
5.4.320.0080.03412.55
5.4.310.0040.04112.55
5.4.300.0060.03612.55
5.4.290.0030.04112.54
5.4.280.0090.03112.44
5.4.270.0070.03412.45
5.4.260.0090.03412.44
5.4.250.0040.03912.44
5.4.240.0060.03612.44
5.4.230.0050.03812.43
5.4.220.0050.03712.43
5.4.210.0050.03612.43
5.4.200.0080.03612.44
5.4.190.0130.03612.43
5.4.180.0090.03312.43
5.4.170.0050.03612.44
5.4.160.0030.03812.43
5.4.150.0070.03512.43
5.4.140.0060.03612.12
5.4.130.0060.03412.11
5.4.120.0060.03412.06
5.4.110.0060.03412.06
5.4.100.0040.03612.05
5.4.90.0040.03812.05
5.4.80.0060.04512.05
5.4.70.0070.04312.05
5.4.60.0060.03712.05
5.4.50.0090.03712.05
5.4.40.0100.04712.04
5.4.30.0060.04012.04
5.4.20.0080.04312.04
5.4.10.0090.03612.04
5.4.00.0070.03411.53
5.3.290.0060.03912.80
5.3.280.0050.04012.71
5.3.270.0110.03612.74
5.3.260.0060.03912.72
5.3.250.0080.03412.73
5.3.240.0060.03712.73
5.3.230.0080.04412.71
5.3.220.0070.04212.69
5.3.210.0070.04012.68
5.3.200.0090.03612.69
5.3.190.0040.03912.69
5.3.180.0080.03512.68
5.3.170.0040.03912.69
5.3.160.0060.03612.68
5.3.150.0050.03812.68
5.3.140.0080.03812.68
5.3.130.0090.04512.67
5.3.120.0040.04012.66
5.3.110.0110.04412.66
5.3.100.0080.04012.16
5.3.90.0050.04812.14
5.3.80.0050.03612.13
5.3.70.0100.04012.13
5.3.60.0060.03512.12
5.3.50.0050.03712.06
5.3.40.0040.03812.06
5.3.30.0080.03212.02
5.3.20.0040.03611.81
5.3.10.0060.03511.77
5.3.00.0060.04811.76
5.2.170.0070.0289.26
5.2.160.0040.0319.26
5.2.150.0060.0299.26
5.2.140.0030.0329.25
5.2.130.0080.0279.22
5.2.120.0040.0299.21
5.2.110.0040.0309.23
5.2.100.0070.0269.22
5.2.90.0120.0329.22
5.2.80.0040.0349.21
5.2.70.0050.0299.21
5.2.60.0040.0309.17
5.2.50.0060.0359.14
5.2.40.0060.0269.11
5.2.30.0090.0329.09
5.2.20.0050.0309.08
5.2.10.0060.0278.98
5.2.00.0040.0288.84
5.1.60.0070.0338.14
5.1.50.0030.0268.13
5.1.40.0090.0208.12
5.1.30.0020.0278.46
5.1.20.0030.0278.48
5.1.10.0030.0278.21
5.1.00.0080.0308.21
5.0.50.0030.0216.70
5.0.40.0030.0206.56
5.0.30.0020.0336.37
5.0.20.0050.0186.34
5.0.10.0040.0196.32
5.0.00.0040.0306.32
4.4.90.0010.0174.78
4.4.80.0050.0134.75
4.4.70.0010.0174.76
4.4.60.0030.0214.76
4.4.50.0020.0274.77
4.4.40.0020.0244.71
4.4.30.0000.0174.76
4.4.20.0040.0134.84
4.4.10.0010.0164.85
4.4.00.0030.0244.76
4.3.110.0030.0154.67
4.3.100.0010.0164.66
4.3.90.0040.0134.63
4.3.80.0010.0254.58
4.3.70.0030.0134.63
4.3.60.0020.0144.63
4.3.50.0040.0204.63
4.3.40.0030.0234.53
4.3.30.0020.0303.32
4.3.20.0020.0153.30
4.3.10.0030.0193.26
4.3.00.0200.0207.11

preferences:
58.18 ms | 401 KiB | 5 Q