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!="/" && $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.40.0070.01018.79
8.3.30.0140.00019.04
8.3.20.0120.00320.13
8.3.10.0080.00023.66
8.3.00.0080.00019.38
8.2.170.0080.00819.13
8.2.160.0060.00922.96
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00021.09
8.2.110.0030.00620.55
8.2.100.0120.00017.63
8.2.90.0050.00319.20
8.2.80.0050.00317.97
8.2.70.0040.00417.63
8.2.60.0030.00517.93
8.2.50.0000.00918.07
8.2.40.0060.00318.28
8.2.30.0040.00418.15
8.2.20.0030.00617.86
8.2.10.0040.00418.06
8.2.00.0040.00417.86
8.1.270.0080.00022.05
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00322.45
8.1.230.0070.00419.09
8.1.220.0090.00017.79
8.1.210.0000.00818.77
8.1.200.0060.00617.35
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0000.00818.53
8.1.160.0040.00422.11
8.1.150.0000.00719.00
8.1.140.0050.00217.50
8.1.130.0000.00817.77
8.1.120.0040.00417.55
8.1.110.0050.00217.41
8.1.100.0030.00317.52
8.1.90.0070.00017.41
8.1.80.0030.00417.50
8.1.70.0030.00317.47
8.1.60.0040.00817.66
8.1.50.0060.00317.50
8.1.40.0080.00017.56
8.1.30.0050.00317.69
8.1.20.0040.00417.67
8.1.10.0000.00717.65
8.1.00.0000.00917.48
8.0.300.0050.00318.77
8.0.290.0050.00216.88
8.0.280.0000.00718.40
8.0.270.0070.00017.30
8.0.260.0030.00317.36
8.0.250.0030.00316.98
8.0.240.0050.00217.11
8.0.230.0000.00716.96
8.0.220.0030.00316.89
8.0.210.0070.00017.00
8.0.200.0030.00317.00
8.0.190.0040.00417.09
8.0.180.0000.00716.91
8.0.170.0000.00817.03
8.0.160.0030.00617.05
8.0.150.0040.00416.96
8.0.140.0000.00716.87
8.0.130.0000.00613.39
8.0.120.0030.00617.00
8.0.110.0050.00316.89
8.0.100.0040.00416.98
8.0.90.0000.00816.84
8.0.80.0110.00817.05
8.0.70.0050.00316.83
8.0.60.0050.00217.05
8.0.50.0030.00516.96
8.0.30.0140.01217.03
8.0.20.0090.01017.40
8.0.10.0080.00016.94
8.0.00.0110.00716.88
7.4.330.0000.00515.09
7.4.320.0060.00016.50
7.4.300.0030.00316.45
7.4.290.0030.00616.59
7.4.280.0040.00716.68
7.4.270.0050.00216.57
7.4.260.0000.00716.54
7.4.250.0070.00016.41
7.4.240.0000.00716.62
7.4.230.0040.00416.63
7.4.220.0200.00616.58
7.4.210.0070.01016.56
7.4.200.0040.00416.75
7.4.160.0120.00416.73
7.4.150.0040.01517.40
7.4.140.0070.01817.86
7.4.130.0090.00816.62
7.4.120.0130.00816.41
7.4.110.0090.00916.81
7.4.100.0030.01316.45
7.4.90.0090.00916.56
7.4.80.0090.00819.39
7.4.70.0090.01516.56
7.4.60.0130.00616.64
7.4.50.0000.00416.36
7.4.40.0140.00316.76
7.4.30.0130.00716.54
7.4.10.0060.01215.16
7.4.00.0090.00914.86
7.3.330.0000.00613.26
7.3.320.0000.00513.47
7.3.310.0040.00416.36
7.3.300.0030.00516.35
7.3.290.0040.01016.46
7.3.280.0060.01016.49
7.3.270.0150.00917.40
7.3.260.0060.01116.41
7.3.250.0140.00616.54
7.3.240.0090.01416.56
7.3.230.0040.01516.61
7.3.210.0090.00916.59
7.3.200.0130.01019.39
7.3.190.0110.00816.61
7.3.180.0060.01016.49
7.3.170.0030.01416.60
7.3.160.0130.00316.56
7.3.130.0060.01315.19
7.3.120.0060.01215.05
7.3.110.0060.01314.93
7.3.100.0090.00614.96
7.3.90.0040.01214.87
7.3.80.0040.00815.06
7.3.70.0070.00715.05
7.3.60.0120.00315.05
7.3.50.0000.00914.96
7.3.40.0080.00814.98
7.3.30.0030.00814.74
7.3.20.0070.01016.81
7.3.10.0110.00416.80
7.3.00.0040.00716.77
7.2.330.0080.00816.84
7.2.320.0120.01216.80
7.2.310.0030.01716.78
7.2.300.0040.01416.87
7.2.290.0190.00416.56
7.2.260.0000.01815.34
7.2.250.0030.01715.05
7.2.240.0040.01114.84
7.2.230.0070.01115.19
7.2.220.0060.00915.30
7.2.210.0000.01415.05
7.2.200.0060.00915.18
7.2.190.0100.00314.94
7.2.180.0030.00915.08
7.2.170.0060.00614.94
7.2.160.0030.01015.25
7.2.150.0100.01017.02
7.2.140.0140.00017.04
7.2.130.0030.00716.82
7.2.120.0030.01416.97
7.2.110.0040.01417.00
7.2.100.0040.00716.74
7.2.90.0040.01116.86
7.2.80.0100.00617.08
7.2.70.0040.01217.14
7.2.60.0060.00617.07
7.2.50.0080.01016.77
7.2.40.0040.00817.16
7.2.30.0030.00717.05
7.2.20.0040.01117.00
7.2.10.0030.01316.69
7.2.00.0070.00716.71
7.1.330.0100.00315.97
7.1.320.0100.00615.55
7.1.310.0000.00815.57
7.1.300.0040.00415.85
7.1.290.0030.01016.02
7.1.280.0030.00715.79
7.1.270.0000.01415.77
7.1.260.0080.00815.97
7.1.250.0090.00615.83
7.1.240.0000.01515.68
7.1.230.0090.00615.80
7.1.220.0060.00315.46
7.1.210.0080.00815.98
7.1.200.0060.00815.78
7.1.190.0030.00915.77
7.1.180.0030.01015.83
7.1.170.0110.00315.72
7.1.160.0040.01515.70
7.1.150.0040.00715.90
7.1.140.0100.00315.78
7.1.130.0000.01415.89
7.1.120.0070.00315.58
7.1.110.0040.01115.80
7.1.100.0030.01017.13
7.1.90.0120.00315.65
7.1.80.0060.00616.04
7.1.70.0020.00916.49
7.1.60.0080.01217.59
7.1.50.0070.01016.59
7.1.40.0040.00715.63
7.1.30.0040.00815.82
7.1.20.0080.00615.77
7.1.10.0030.01315.68
7.1.00.0030.04119.07
7.0.330.0040.01115.41
7.0.320.0060.00615.59
7.0.310.0090.00315.48
7.0.300.0090.00315.45
7.0.290.0130.00015.46
7.0.280.0070.00715.63
7.0.270.0040.00815.36
7.0.260.0060.00615.42
7.0.250.0030.01015.63
7.0.240.0000.01015.51
7.0.230.0070.00615.57
7.0.220.0000.00815.57
7.0.210.0000.01515.23
7.0.200.0040.00716.05
7.0.190.0130.00015.52
7.0.180.0000.01215.48
7.0.170.0040.00415.29
7.0.160.0030.01315.52
7.0.150.0030.01015.29
7.0.140.0080.03518.70
7.0.130.0040.00415.25
7.0.120.0080.00415.70
7.0.110.0000.01315.42
7.0.100.0060.00615.14
7.0.90.0090.00615.51
7.0.80.0100.00315.49
7.0.70.0090.00015.43
7.0.60.0120.03917.68
7.0.50.0050.04016.77
7.0.40.0050.03516.92
7.0.30.0210.03716.68
7.0.20.0120.02816.84
7.0.10.0080.04416.62
7.0.00.0100.02716.91
5.6.400.0040.01114.82
5.6.390.0090.00614.67
5.6.380.0030.01014.49
5.6.370.0110.00414.67
5.6.360.0150.00414.61
5.6.350.0060.00313.98
5.6.340.0070.01014.34
5.6.330.0040.00814.84
5.6.320.0040.01114.12
5.6.310.0000.01814.76
5.6.300.0060.00914.38
5.6.290.0040.01214.80
5.6.280.0130.03517.67
5.6.270.0070.00714.36
5.6.260.0000.01114.31
5.6.250.0000.00914.71
5.6.240.0080.00414.42
5.6.230.0000.00914.34
5.6.220.0040.00714.38
5.6.210.0000.04617.52
5.6.200.0070.04216.26
5.6.190.0040.04317.52
5.6.180.0100.04317.32
5.6.170.0180.04317.43
5.6.160.0050.03417.35
5.6.150.0030.04616.39
5.6.140.0100.03716.39
5.6.130.0120.01716.40
5.6.120.0080.04117.78
5.6.110.0070.05017.61
5.6.100.0070.03617.81
5.6.90.0040.04917.74
5.6.80.0030.02217.41
5.6.70.2300.02817.58
5.6.60.0030.00814.33
5.6.50.0100.00314.69
5.6.40.0030.00714.36
5.6.30.0100.00714.41
5.6.20.0030.00714.16
5.6.10.0000.01514.25
5.6.00.0000.01114.42
5.5.380.0090.00614.61
5.5.370.0070.00714.08
5.5.360.0030.00914.28
5.5.350.0160.01817.55
5.5.340.0030.02616.28
5.5.330.0070.03817.50
5.5.320.0190.03717.52
5.5.310.0190.03017.59
5.5.300.0080.04316.28
5.5.290.0090.03516.24
5.5.280.0090.04317.65
5.5.270.0060.02517.56
5.5.260.0050.02217.84
5.5.250.0070.04317.40
5.5.240.1850.01617.33
5.5.230.0000.00914.51
5.5.220.0000.01314.13
5.5.210.0120.00014.18
5.5.200.0070.00414.64
5.5.190.0040.01114.57
5.5.180.0070.00414.26
5.5.170.0070.00414.27
5.5.160.0060.00814.25
5.5.150.0110.00314.61
5.5.140.0060.00614.43
5.5.130.0030.01014.48
5.5.120.0070.00714.16
5.5.110.0060.00614.55
5.5.100.0140.00014.33
5.5.90.0000.01114.62
5.5.80.0000.01614.23
5.5.70.0040.01114.16
5.5.60.0130.00314.10
5.5.50.0040.00714.53
5.5.40.0030.00714.29
5.5.30.0000.01314.04
5.5.20.0060.00914.14
5.5.10.0030.01414.39
5.5.00.0000.01314.02
5.4.450.0220.03315.03
5.4.440.0200.02315.18
5.4.430.0180.03915.49
5.4.420.0170.03315.27
5.4.410.0180.03815.22
5.4.400.0230.02815.24
5.4.390.0210.02015.06
5.4.380.0170.01815.13
5.4.370.0220.02315.04
5.4.360.0150.02615.27
5.4.350.0150.02815.19
5.4.340.0190.03515.19
5.4.330.0040.00711.15
5.4.320.0270.03015.07
5.4.310.0200.03015.08
5.4.300.0150.02315.02
5.4.290.0120.02715.04
5.4.280.0170.03515.05
5.4.270.0200.02714.95
5.4.260.0150.03815.37
5.4.250.0170.02315.13
5.4.240.0190.03414.93
5.4.230.0190.02215.28
5.4.220.0170.02514.82
5.4.210.0200.02415.20
5.4.200.0220.03315.07
5.4.190.0200.02715.01
5.4.180.0180.03014.95
5.4.170.0170.03915.04
5.4.160.0200.04015.22
5.4.150.0230.03714.94
5.4.140.0120.04313.77
5.4.130.0210.02713.81
5.4.120.0230.03313.71
5.4.110.0200.03813.86
5.4.100.0210.03613.89
5.4.90.0200.01813.65
5.4.80.0150.02413.72
5.4.70.0150.02513.84
5.4.60.0210.01813.81
5.4.50.0150.02913.84
5.4.40.0270.02913.83
5.4.30.0210.03813.87
5.4.20.0200.02113.97
5.4.10.0170.03913.69
5.4.00.0170.02413.53
5.3.290.0270.07714.61
5.3.280.0430.06714.71
5.3.270.0330.06314.80
5.3.260.0430.06714.56
5.3.250.0330.06314.73
5.3.240.0330.07014.54
5.3.230.0370.06714.56
5.3.220.0300.06314.66
5.3.210.0400.05714.58
5.3.200.0300.03714.52
5.3.190.0300.07714.61
5.3.180.0270.05014.59
5.3.170.0330.07014.82
5.3.160.0270.04314.62
5.3.150.0330.07314.52
5.3.140.0370.06014.57
5.3.130.0330.04014.64
5.3.120.0330.06714.48
5.3.110.0300.03714.81
5.3.100.0300.03314.30
5.3.90.0370.06313.96
5.3.80.0370.04314.06
5.3.70.0400.06013.96
5.3.60.0430.04013.95
5.3.50.0330.06713.89
5.3.40.0470.05713.96
5.3.30.0330.05713.87
5.3.20.0500.03713.70
5.3.10.0230.06313.78
5.3.00.0330.05713.68
5.2.170.0370.03711.10
5.2.160.0200.04311.34
5.2.150.0270.06311.23
5.2.140.0270.04711.19
5.2.130.0300.03711.06
5.2.120.0200.05311.21
5.2.110.0370.04311.11
5.2.100.0230.03311.25
5.2.90.0470.04311.20
5.2.80.0270.06311.05
5.2.70.0330.03011.05
5.2.60.0200.05711.02
5.2.50.0200.03710.97
5.2.40.0170.03010.94
5.2.30.0230.03710.93
5.2.20.0230.03311.11
5.2.10.0230.03710.82
5.2.00.0200.06010.80
5.1.60.0200.03310.02
5.1.50.0200.05310.03
5.1.40.0270.04710.00
5.1.30.0270.06310.43
5.1.20.0200.03310.52
5.1.10.0230.03010.00
5.1.00.0270.04710.20
5.0.50.0070.0439.84
5.0.40.0170.0409.84
5.0.30.0130.0609.84
5.0.20.0170.0309.84
5.0.10.0200.0379.84
5.0.00.0170.0379.84
4.4.90.0070.0179.84
4.4.80.0100.0179.84
4.4.70.0170.0139.84
4.4.60.0170.0139.84
4.4.50.0170.0309.84
4.4.40.0070.0279.84
4.4.30.0070.0379.84
4.4.20.0130.0309.84
4.4.10.0070.0279.84
4.4.00.0130.0479.84
4.3.110.0200.0279.84
4.3.100.0130.0339.84
4.3.90.0070.0239.84
4.3.80.0270.0279.84
4.3.70.0100.0179.84
4.3.60.0170.0239.84
4.3.50.0100.0379.84
4.3.40.0130.0379.84
4.3.30.0070.0179.84
4.3.20.0030.0339.84
4.3.10.0070.0339.84
4.3.00.0070.0309.84

preferences:
47.97 ms | 400 KiB | 5 Q