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=="/"){ $tag = ""; }elseif($html && $char!="/" && $t > 1){ $tag .= $char; } if(!$html) $i++; $return .= $char; if($i==$size) $break = true; if($char == " " && !$html && $break){ $return .= '</'.$tag.'>'."<br><br>".'<'.$tag.'>'; $i=0; $break = false; } } 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.40.0040.01118.65
8.3.30.0140.00019.14
8.3.20.0090.00620.14
8.3.10.0090.00023.64
8.3.00.0090.00019.25
8.2.170.0100.00722.96
8.2.160.0110.00420.35
8.2.150.0050.00324.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0050.00322.05
8.2.110.0100.00022.04
8.2.100.0060.00617.75
8.2.90.0000.00819.35
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0000.00718.22
8.2.30.0000.00718.04
8.2.20.0080.00017.80
8.2.10.0080.00018.07
8.2.00.0060.00317.78
8.1.270.0040.00422.07
8.1.260.0000.00726.35
8.1.250.0050.00228.09
8.1.240.0060.00324.00
8.1.230.0070.00319.15
8.1.220.0030.00517.78
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0080.00018.53
8.1.160.0000.00822.04
8.1.150.0000.00718.91
8.1.140.0000.00717.52
8.1.130.0050.00217.89
8.1.120.0040.00417.52
8.1.110.0070.00017.34
8.1.100.0040.00417.50
8.1.90.0040.00417.47
8.1.80.0070.00017.50
8.1.70.0070.00017.45
8.1.60.0100.00017.65
8.1.50.0040.00417.48
8.1.40.0030.00617.47
8.1.30.0040.00417.61
8.1.20.0060.00317.69
8.1.10.0040.00417.48
8.1.00.0030.00617.41
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0040.00418.36
8.0.270.0040.00417.29
8.0.260.0030.00317.25
8.0.250.0030.00517.10
8.0.240.0080.00016.98
8.0.230.0030.00416.98
8.0.220.0050.00217.01
8.0.210.0070.00016.96
8.0.200.0000.00716.93
8.0.190.0030.00617.06
8.0.180.0000.00916.95
8.0.170.0040.00417.01
8.0.160.0000.00816.96
8.0.150.0000.00716.86
8.0.140.0040.00416.77
8.0.130.0000.00513.46
8.0.120.0040.00416.84
8.0.110.0070.00016.92
8.0.100.0040.00417.03
8.0.90.0000.00717.05
8.0.80.0030.01716.98
8.0.70.0000.00717.02
8.0.60.0070.00016.80
8.0.50.0030.00616.84
8.0.30.0110.01117.24
8.0.20.0090.01217.40
8.0.10.0070.00017.02
8.0.00.0050.01216.67
7.4.330.0000.00615.02
7.4.320.0040.00416.55
7.4.300.0020.00516.53
7.4.290.0000.00916.63
7.4.280.0070.00316.55
7.4.270.0070.00016.47
7.4.260.0040.00416.56
7.4.250.0050.00216.51
7.4.240.0020.00516.62
7.4.230.0000.00716.64
7.4.220.0060.01216.74
7.4.210.0070.01016.65
7.4.200.0050.00216.53
7.4.160.0100.00916.66
7.4.150.0080.01117.40
7.4.140.0130.00717.86
7.4.130.0060.01316.61
7.4.120.0070.00916.68
7.4.110.0030.01416.68
7.4.100.0080.00816.35
7.4.90.0100.00616.57
7.4.80.0110.00619.39
7.4.70.0070.01416.66
7.4.60.0140.00416.58
7.4.50.0040.00416.36
7.4.40.0070.01016.48
7.4.30.0150.00616.67
7.4.00.0060.00615.04
7.3.330.0000.00513.32
7.3.320.0000.00613.46
7.3.310.0070.00016.50
7.3.300.0040.00416.47
7.3.290.0080.01016.49
7.3.280.0090.00716.47
7.3.270.0130.00717.40
7.3.260.0140.00316.51
7.3.250.0150.00816.46
7.3.240.0130.01016.47
7.3.230.0080.00916.46
7.3.210.0030.01516.57
7.3.200.0090.00619.39
7.3.190.0110.00616.50
7.3.180.0130.01016.55
7.3.170.0130.00316.64
7.3.160.0060.01016.38
7.3.10.0090.00316.77
7.3.00.0030.00616.80
7.2.330.0110.00716.49
7.2.320.0140.00716.71
7.2.310.0070.01016.88
7.2.300.0080.00916.63
7.2.290.0090.00916.84
7.2.130.0070.00416.97
7.2.120.0030.01016.98
7.2.110.0080.00416.77
7.2.100.0060.00317.00
7.2.90.0000.01616.88
7.2.80.0030.00716.81
7.2.70.0030.01216.90
7.2.60.0000.01416.92
7.2.50.0060.00616.97
7.2.40.0060.01216.69
7.2.30.0100.00317.00
7.2.20.0070.00716.96
7.2.10.0100.00316.99
7.2.00.0070.00818.12
7.1.250.0030.00915.77
7.1.100.0000.01218.28
7.1.70.0060.00616.93
7.1.60.0060.00617.18
7.1.50.0000.02417.01
7.1.00.0000.07722.46
7.0.200.0000.01516.77
7.0.140.0030.07322.16
7.0.60.0030.04020.02
7.0.50.0070.04318.00
7.0.40.0070.04320.30
7.0.30.0230.06720.13
7.0.20.0300.07720.10
7.0.10.0030.05020.20
7.0.00.0100.04320.13
5.6.280.0000.07721.14
5.6.210.0030.04020.54
5.6.200.0070.05718.19
5.6.190.0130.05720.63
5.6.180.0170.08320.61
5.6.170.0230.05320.45
5.6.160.0070.04320.54
5.6.150.0070.08318.22
5.6.140.0030.09018.18
5.6.130.0070.08718.18
5.6.120.0130.06321.07
5.6.110.0000.09021.02
5.6.100.0070.07321.13
5.6.90.0030.07021.01
5.6.80.0100.08020.43
5.6.70.4600.04320.50
5.5.350.0300.08020.36
5.5.340.0030.04018.05
5.5.330.0030.08020.27
5.5.320.0370.07020.25
5.5.310.0230.07720.32
5.5.300.0000.09017.95
5.5.290.0070.07717.98
5.5.280.0070.08720.80
5.5.270.0030.04021.01
5.5.260.0030.06020.91
5.5.250.0030.04020.83
5.5.240.3770.03320.07
5.4.450.0600.06319.58
5.4.440.0600.06019.55
5.4.430.0730.05019.18
5.4.420.0770.05019.30
5.4.410.0700.06319.49
5.4.400.0030.06019.30
5.4.390.0800.05319.37
5.4.380.0630.05719.14
5.4.370.0130.05319.25
5.4.360.0770.05018.84
5.4.350.0070.05319.30
5.4.340.0040.03812.05
5.4.320.0090.03512.54
5.4.310.0050.04212.54
5.4.300.0080.03612.54
5.4.290.0060.04712.54
5.4.280.0090.05012.44
5.4.270.0110.03612.44
5.4.260.0080.04512.44
5.4.250.0080.07112.44
5.4.240.0080.05012.43
5.4.230.0130.04812.43
5.4.220.0130.04612.43
5.4.210.0050.04012.43
5.4.200.0060.03912.43
5.4.190.0050.03712.43
5.4.180.0060.03912.43
5.4.170.0070.04812.43
5.4.160.0070.04112.43
5.4.150.0090.03312.43
5.4.140.0040.03912.11
5.4.130.0050.03912.10
5.4.120.0070.03612.06
5.4.110.0060.03812.05
5.4.100.0070.03412.05
5.4.90.0030.04012.05
5.4.80.0070.03512.05
5.4.70.0060.03412.05
5.4.60.0070.03512.05
5.4.50.0020.04012.05
5.4.40.0050.03512.03
5.4.30.0030.04012.03
5.4.20.0060.03612.04
5.4.10.0090.04012.03
5.4.00.0060.03811.52
5.3.290.0050.04612.80
5.3.280.0080.04912.71
5.3.270.0080.03912.73
5.3.260.0090.04012.73
5.3.250.0070.04212.73
5.3.240.0070.03712.72
5.3.230.0060.03812.72
5.3.220.0060.03712.68
5.3.210.0060.03912.69
5.3.200.0090.03612.68
5.3.190.0050.04212.69
5.3.180.0040.04512.68
5.3.170.0040.03812.68
5.3.160.0060.03612.68
5.3.150.0060.04112.68
5.3.140.0050.04412.68
5.3.130.0050.04012.67
5.3.120.0070.03812.67
5.3.110.0070.04512.66
5.3.100.0110.03612.16
5.3.90.0070.03912.14
5.3.80.0070.03912.13
5.3.70.0040.04312.13
5.3.60.0060.04012.11
5.3.50.0050.03712.06
5.3.40.0050.04012.06
5.3.30.0070.03412.02
5.3.20.0040.03811.80
5.3.10.0050.03511.76
5.3.00.0050.03711.75
5.2.170.0040.0329.25
5.2.160.0020.0329.25
5.2.150.0020.0339.25
5.2.140.0070.0329.25
5.2.130.0110.0249.21
5.2.120.0080.0259.21
5.2.110.0050.0309.22
5.2.100.0050.0299.22
5.2.90.0070.0269.22
5.2.80.0050.0309.21
5.2.70.0070.0299.21
5.2.60.0040.0329.16
5.2.50.0050.0309.13
5.2.40.0050.0299.11
5.2.30.0080.0289.09
5.2.20.0050.0319.08
5.2.10.0050.0298.98
5.2.00.0030.0308.85
5.1.60.0030.0258.13
5.1.50.0060.0268.13
5.1.40.0040.0258.11
5.1.30.0060.0258.47
5.1.20.0040.0288.49
5.1.10.0030.0338.21
5.1.00.0040.0278.21
5.0.50.0030.0226.70
5.0.40.0050.0186.55
5.0.30.0060.0296.37
5.0.20.0050.0186.33
5.0.10.0040.0196.31
5.0.00.0040.0316.31
4.4.90.0020.0164.77
4.4.80.0040.0144.75
4.4.70.0030.0154.75
4.4.60.0020.0174.76
4.4.50.0050.0154.77
4.4.40.0020.0284.70
4.4.30.0040.0164.76
4.4.20.0010.0194.85
4.4.10.0030.0184.85
4.4.00.0070.0244.76
4.3.110.0020.0224.67
4.3.100.0020.0194.67
4.3.90.0030.0174.63
4.3.80.0040.0244.58
4.3.70.0040.0134.63
4.3.60.0030.0144.63
4.3.50.0050.0144.63
4.3.40.0020.0244.53
4.3.30.0020.0163.32
4.3.20.0010.0173.30
4.3.10.0020.0163.26
4.3.00.0100.0236.80

preferences:
43.17 ms | 400 KiB | 5 Q