3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = "输入法. 手写; 拼音; 关闭. 百科 文库 hao123 | 更多>> · 把百度设为主页把百度设为主页关于百度About Baidu. ©2014 Baidu 使用百度前必读 京ICP证030173号.";$end_html = 0;$start_html = 1;$tmp_message = '';$message = ' ' . $message . ' ';$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#');$html_entities_replace = array('&amp;', '&lt;', '&gt;');$html_on = 1; $bbcode_on = 1;$bbcode_uid = 1;$message = trim($message); if ($html_on) { $allowed_html_tags = split(',', '<b>,</b>'); $end_html = 0; $start_html = 1; $tmp_message = ''; $message = ' ' . $message . ' '; while ($start_html = strpos($message, '<', $start_html)) { $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1))); if ($end_html = strpos($message, '>', $start_html)) { $length = $end_html - $start_html + 1; $hold_string = substr($message, $start_html, $length); if (($unclosed_open = strrpos(' ' . $hold_string, '<')) != 1) { $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1)); $hold_string = substr($hold_string, $unclosed_open - 1); } $tagallowed = false; for ($i = 0; $i < sizeof($allowed_html_tags); $i++) { $match_tag = trim($allowed_html_tags[$i]); if (preg_match('#^<\/?' . $match_tag . '[> ]#i', $hold_string)) { $tagallowed = (preg_match('#^<\/?' . $match_tag . ' .*?(style[ ]*?=|on[\w]+[ ]*?=)#i', $hold_string)) ? false : true; } } $tmp_message .= ($length && !$tagallowed) ? preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string; $start_html += $length; } else { $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $start_html, strlen($message))); $start_html = strlen($message); $end_html = $start_html; } } if ($end_html != strlen($message) && $tmp_message != '') { $tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1)); } $message = ($tmp_message != '') ? trim($tmp_message) : trim($message); } else { $message = preg_replace($html_entities_match, $html_entities_replace, $message); } // Decode the html entities for HTMLArea / TMEdit $message = str_replace('&amp;', '&', $message); $message = html_entity_decode($message); if($bbcode_on && $bbcode_uid != '') { $message = bbencode_first_pass($message, $bbcode_uid); } echo $message;

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.0070.00716.75
8.3.50.0210.00621.85
8.3.40.0110.00418.79
8.3.30.0070.00719.04
8.3.20.0000.00820.41
8.3.10.0040.00421.94
8.3.00.0030.00618.05
8.2.180.0180.00416.50
8.2.170.0090.00622.96
8.2.160.0110.00420.57
8.2.150.0100.00324.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00421.02
8.2.110.0090.00019.17
8.2.100.0030.00918.03
8.2.90.0000.00819.27
8.2.80.0000.00817.97
8.2.70.0030.00617.73
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0060.00618.09
8.2.30.0000.00818.20
8.2.20.0040.00417.66
8.2.10.0040.00418.23
8.2.00.0000.00817.75
8.1.280.0070.01025.92
8.1.270.0090.00023.75
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0060.00322.18
8.1.230.0040.00719.05
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0000.01017.36
8.1.190.0050.00317.35
8.1.180.0080.00018.10
8.1.170.0050.00318.64
8.1.160.0030.00622.11
8.1.150.0000.00718.82
8.1.140.0000.00917.42
8.1.130.0030.00517.86
8.1.120.0050.00217.48
8.1.110.0000.00817.39
8.1.100.0000.00717.50
8.1.90.0070.00317.53
8.1.80.0000.00717.40
8.1.70.0000.00717.50
8.1.60.0000.00917.63
8.1.50.0000.00817.45
8.1.40.0060.00317.43
8.1.30.0050.00317.58
8.1.20.0030.00517.68
8.1.10.0030.00517.54
8.1.00.0040.00417.45
8.0.300.0040.00420.11
8.0.290.0050.00216.88
8.0.280.0030.00318.52
8.0.270.0070.00017.26
8.0.260.0000.00817.17
8.0.250.0000.00717.09
8.0.240.0040.00416.92
8.0.230.0000.00717.01
8.0.220.0000.00817.02
8.0.210.0070.00016.96
8.0.200.0060.00017.04
8.0.190.0030.00517.04
8.0.180.0000.00717.03
8.0.170.0000.00817.06
8.0.160.0070.00016.87
8.0.150.0040.00416.88
8.0.140.0050.00216.98
8.0.130.0030.00313.38
8.0.120.0040.00416.97
8.0.110.0040.00416.88
8.0.100.0030.00617.05
8.0.90.0070.00017.06
8.0.80.0060.00916.98
8.0.70.0040.00416.96
8.0.60.0040.00416.78
8.0.50.0050.00316.74
8.0.30.0170.00817.14
8.0.20.0130.01117.40
8.0.10.0000.00817.09
8.0.00.0150.00216.72
7.4.330.0000.00515.01
7.4.320.0030.00316.59
7.4.300.0000.00616.64
7.4.290.0030.00316.69
7.4.280.0000.00816.54
7.4.270.0030.00316.65
7.4.260.0030.00316.54
7.4.250.0000.00716.61
7.4.240.0040.00416.58
7.4.230.0000.00716.54
7.4.220.0140.00416.73
7.4.210.0030.01016.58
7.4.200.0070.00016.64
7.4.160.0030.01316.56
7.4.150.0060.01217.40
7.4.140.0090.00917.86
7.4.130.0160.00816.60
7.4.120.0100.00716.55
7.4.110.0090.00916.52
7.4.100.0170.00616.52
7.4.90.0090.01616.50
7.4.80.0120.01119.39
7.4.70.0080.01116.70
7.4.60.0070.01016.68
7.4.50.0030.00616.53
7.4.40.0090.01616.32
7.4.30.0060.01016.72
7.4.00.0100.00714.82
7.3.330.0020.00213.15
7.3.320.0020.00213.15
7.3.310.0000.00716.39
7.3.300.0000.00716.30
7.3.290.0040.01116.40
7.3.280.0080.01116.38
7.3.270.0090.00917.40
7.3.260.0100.01416.46
7.3.240.0110.00616.39
7.3.230.0060.01016.39
7.3.210.0130.00316.32
7.3.200.0160.00619.39
7.3.190.0120.00416.43
7.3.180.0040.01216.63
7.3.170.0150.00716.47
7.3.160.0060.01716.49
7.3.120.0110.00614.86
7.3.110.0100.00614.86
7.3.100.0000.01214.95
7.3.90.0130.00314.94
7.3.80.0060.00914.99
7.3.70.0040.01214.89
7.3.60.0030.01014.88
7.3.50.0070.00715.05
7.3.40.0030.01015.00
7.3.30.0060.00614.91
7.3.20.0060.00616.46
7.3.10.0070.01016.63
7.3.00.0060.00916.51
7.2.330.0030.01416.84
7.2.320.0130.00316.64
7.2.310.0120.00416.45
7.2.300.0070.01016.76
7.2.290.0110.00916.56
7.2.250.0090.00615.16
7.2.240.0040.01515.19
7.2.230.0060.00615.16
7.2.220.0000.01115.04
7.2.210.0090.00615.13
7.2.200.0040.00715.14
7.2.190.0030.01015.00
7.2.180.0070.01114.80
7.2.170.0030.00614.91
7.2.60.0090.00916.94
7.1.330.0120.00315.87
7.1.320.0000.01315.96
7.1.310.0070.01015.94
7.1.300.0100.00315.59
7.1.290.0030.00615.75
7.1.280.0080.00415.91
7.1.270.0070.00715.68
7.1.260.0100.00015.83
7.1.200.0080.00315.77
7.1.100.0130.00918.10
7.1.70.0000.00917.32
7.1.60.0090.01219.25
7.1.50.0100.01016.88
7.1.00.0070.07322.44
7.0.200.0000.00916.97
7.0.140.0030.07322.06
7.0.60.0100.08020.05
7.0.50.0170.04717.84
7.0.40.0030.04320.04
7.0.30.0230.07720.16
7.0.20.0400.07020.00
7.0.10.0030.05020.17
7.0.00.0030.05720.19
5.6.280.0100.06721.09
5.6.210.0000.05720.58
5.6.200.0100.05718.16
5.6.190.0130.09320.57
5.6.180.0270.07320.27
5.6.170.0300.05020.51
5.6.160.0030.09320.40
5.6.150.0070.07318.18
5.6.140.0100.08018.18
5.6.130.0070.04018.21
5.6.120.0100.08720.98
5.6.110.0030.07721.02
5.6.100.0100.07721.02
5.6.90.0070.09021.11
5.6.80.0030.08720.27
5.5.350.0000.08720.40
5.5.340.0000.05718.00
5.5.330.0000.08720.29
5.5.320.0130.07320.29
5.5.310.0270.07720.20
5.5.300.0070.05017.93
5.5.290.0000.08717.95
5.5.280.0130.06720.98
5.5.270.0130.07320.83
5.5.260.0200.07020.85
5.5.250.0000.08020.79
5.5.240.4300.04320.08
5.4.450.0400.04319.26
5.4.440.0600.05019.58
5.4.430.1100.03719.37
5.4.420.0570.04019.10
5.4.410.0630.03319.30
5.4.400.0500.03319.24
5.4.390.0470.03719.14
5.4.380.0700.05718.66
5.4.370.0900.05318.66
5.4.360.0470.06018.57
5.4.350.0500.05318.66
5.4.340.0800.05018.67
5.4.320.0060.04112.48
5.4.310.0070.03812.47
5.4.300.0120.03712.48
5.4.290.0030.04712.47
5.4.280.0080.03312.37
5.4.270.0090.03312.37
5.4.260.0030.04712.37
5.4.250.0060.03612.37
5.4.240.0020.03912.37
5.4.230.0070.03712.36
5.4.220.0040.03912.36
5.4.210.0090.03312.36
5.4.200.0050.03912.36
5.4.190.0070.03612.36
5.4.180.0070.03512.36
5.4.170.0040.03712.37
5.4.160.0090.03212.37
5.4.150.0050.03512.36
5.4.140.0030.03912.04
5.4.130.0060.03412.03
5.4.120.0080.04411.99
5.4.110.0030.03711.99
5.4.100.0110.03311.99
5.4.90.0080.03711.99
5.4.80.0030.05011.99
5.4.70.0080.03111.98
5.4.60.0080.04011.98
5.4.50.0060.03411.98
5.4.40.0030.04011.97
5.4.30.0050.03511.97
5.4.20.0040.04311.97
5.4.10.0040.03511.97
5.4.00.0040.03711.46
5.3.290.0060.04212.80
5.3.280.0060.03712.71
5.3.270.0080.04212.73
5.3.260.0070.04012.72
5.3.250.0130.03712.72
5.3.240.0080.03912.71
5.3.230.0090.03512.71
5.3.220.0020.04212.68
5.3.210.0060.04312.68
5.3.200.0050.03812.68
5.3.190.0080.03912.68
5.3.180.0050.03712.67
5.3.170.0120.03112.67
5.3.160.0030.04412.67
5.3.150.0060.03812.67
5.3.140.0040.04512.66
5.3.130.0100.03512.65
5.3.120.0040.04112.66
5.3.110.0030.04212.65
5.3.100.0070.03512.12
5.3.90.0080.04012.09
5.3.80.0090.03712.07
5.3.70.0090.03212.07
5.3.60.0060.03512.06
5.3.50.0080.04112.01
5.3.40.0060.03512.01
5.3.30.0020.03811.97
5.3.20.0060.03811.75
5.3.10.0060.03711.71
5.3.00.0060.03511.70
5.2.170.0040.0309.21
5.2.160.0060.0279.21
5.2.150.0060.0289.21
5.2.140.0030.0319.20
5.2.130.0060.0279.16
5.2.120.0030.0299.17
5.2.110.0080.0309.17
5.2.100.0040.0289.17
5.2.90.0040.0389.16
5.2.80.0060.0339.16
5.2.70.0070.0279.16
5.2.60.0040.0299.12
5.2.50.0030.0319.08
5.2.40.0040.0299.06
5.2.30.0100.0329.04
5.2.20.0050.0279.02
5.2.10.0040.0288.95
5.2.00.0040.0328.80
5.1.60.0070.0278.09
5.1.50.0020.0258.09
5.1.40.0030.0298.07
5.1.30.0070.0228.42
5.1.20.0060.0248.45
5.1.10.0080.0238.16
5.1.00.0060.0318.17
5.0.50.0020.0276.66
5.0.40.0040.0196.52
5.0.30.0040.0356.33
5.0.20.0030.0226.30
5.0.10.0020.0276.28
5.0.00.0050.0386.28
4.4.90.0020.0164.78
4.4.80.0020.0214.76
4.4.70.0050.0174.76
4.4.60.0020.0174.75
4.4.50.0030.0144.77
4.4.40.0030.0304.71
4.4.30.0040.0204.76
4.4.20.0060.0124.84
4.4.10.0030.0164.85
4.4.00.0040.0234.76
4.3.110.0020.0174.67
4.3.100.0020.0164.66
4.3.90.0020.0154.63
4.3.80.0020.0254.58
4.3.70.0040.0134.63
4.3.60.0020.0154.63
4.3.50.0050.0204.63
4.3.40.0020.0244.54
4.3.30.0010.0163.33
4.3.20.0020.0153.30
4.3.10.0020.0223.26
4.3.00.0030.02015.29

preferences:
38.11 ms | 401 KiB | 5 Q