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(',', $board_config['allow_html_tags']); $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.0080.00818.27
8.3.50.0100.00921.99
8.3.40.0070.00720.60
8.3.30.0070.00718.89
8.3.20.0070.00020.16
8.3.10.0000.00821.91
8.3.00.0080.00017.80
8.2.180.0030.01318.38
8.2.170.0110.00422.96
8.2.160.0000.01720.57
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0000.00826.16
8.2.120.0040.00420.90
8.2.110.0030.00620.37
8.2.100.0110.00017.72
8.2.90.0080.00019.08
8.2.80.0000.00817.97
8.2.70.0060.00317.60
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0040.00717.91
8.2.30.0040.00418.15
8.2.20.0050.00217.68
8.2.10.0080.00018.03
8.2.00.0000.00817.83
8.1.280.0090.00925.92
8.1.270.0040.00423.91
8.1.260.0050.00226.35
8.1.250.0070.00028.09
8.1.240.0090.00023.92
8.1.230.0070.00423.86
8.1.220.0050.00317.79
8.1.210.0030.00618.77
8.1.200.0030.00717.35
8.1.190.0030.00617.35
8.1.180.0050.00318.10
8.1.170.0030.00618.52
8.1.160.0000.00822.00
8.1.150.0030.00618.91
8.1.140.0070.00317.48
8.1.130.0030.00317.81
8.1.120.0000.00717.49
8.1.110.0040.00417.47
8.1.100.0040.00417.46
8.1.90.0060.00317.38
8.1.80.0050.00217.48
8.1.70.0030.00317.44
8.1.60.0040.00417.63
8.1.50.0000.00817.46
8.1.40.0040.00417.54
8.1.30.0000.00817.69
8.1.20.0050.00317.64
8.1.10.0030.00617.62
8.1.00.0030.00617.53
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0000.00718.42
8.0.270.0070.00017.29
8.0.260.0000.00817.27
8.0.250.0000.00716.92
8.0.240.0040.00416.95
8.0.230.0070.00017.08
8.0.220.0040.00316.95
8.0.210.0040.00416.88
8.0.200.0000.00717.01
8.0.190.0030.00517.03
8.0.180.0040.00417.00
8.0.170.0040.00416.89
8.0.160.0040.00416.99
8.0.150.0070.00016.82
8.0.140.0070.00016.84
8.0.130.0060.00013.42
8.0.120.0060.00316.86
8.0.110.0030.00516.91
8.0.100.0040.00416.89
8.0.90.0030.00316.95
8.0.80.0030.01217.04
8.0.70.0050.00216.98
8.0.60.0000.00716.79
8.0.50.0080.00016.96
8.0.30.0100.01017.04
8.0.20.0120.00817.40
8.0.10.0050.00317.11
8.0.00.0110.00616.79
7.4.330.0020.00215.13
7.4.320.0060.00016.57
7.4.300.0030.00316.44
7.4.290.0000.00716.64
7.4.280.0030.00616.66
7.4.270.0000.00716.54
7.4.260.0030.00316.69
7.4.250.0050.00216.44
7.4.240.0040.00416.46
7.4.230.0070.00016.53
7.4.220.0060.01216.43
7.4.210.0100.00616.66
7.4.200.0030.00316.43
7.4.160.0120.00316.36
7.4.150.0090.00917.40
7.4.140.0090.00817.86
7.4.130.0160.00416.72
7.4.120.0130.00816.55
7.4.110.0060.01116.55
7.4.100.0090.00916.61
7.4.90.0090.00916.52
7.4.80.0070.01119.39
7.4.70.0110.00716.58
7.4.60.0090.00916.47
7.4.50.0000.00716.47
7.4.40.0030.01316.32
7.4.30.0040.01216.82
7.4.00.0100.00614.80
7.3.330.0000.00513.10
7.3.320.0020.00213.29
7.3.310.0000.00716.48
7.3.300.0030.00316.14
7.3.290.0030.01216.34
7.3.280.0110.00816.36
7.3.270.0070.01417.40
7.3.260.0150.00616.41
7.3.240.0100.01416.34
7.3.230.0100.00616.50
7.3.210.0070.01116.34
7.3.200.0170.00019.39
7.3.190.0080.00916.53
7.3.180.0060.00916.54
7.3.170.0150.00916.55
7.3.160.0100.00616.46
7.3.120.0030.00615.08
7.2.330.0140.00316.60
7.2.320.0130.00316.64
7.2.310.0090.01316.57
7.2.300.0070.01016.57
7.2.290.0090.01216.43
7.2.60.0070.00716.73
7.2.00.0030.00719.53
7.1.200.0000.01115.84
7.1.100.0150.00717.96
7.1.70.0000.01017.07
7.1.60.0110.01419.25
7.1.50.0040.01816.88
7.1.00.0100.07322.54
7.0.200.0000.00716.82
7.0.140.0030.07322.12
7.0.60.0070.07320.06
7.0.50.0030.04017.94
7.0.40.0070.08720.02
7.0.30.0170.04320.17
7.0.20.0200.08320.13
7.0.10.0030.09320.30
7.0.00.0070.04320.11
5.6.280.0070.07021.09
5.6.210.0070.08020.71
5.6.200.0100.08018.13
5.6.190.0130.08320.64
5.6.180.0230.04020.33
5.6.170.0330.07020.33
5.6.160.0000.09020.27
5.6.150.0030.08018.09
5.6.140.0070.04318.11
5.6.130.0100.08018.12
5.6.120.0030.05321.01
5.6.110.0130.08021.13
5.6.100.0100.07321.09
5.6.90.0070.05321.00
5.6.80.0100.08320.40
5.5.350.0030.06320.39
5.5.340.0100.08018.02
5.5.330.0070.05020.07
5.5.320.0030.08020.27
5.5.310.0230.04320.33
5.5.300.0070.05718.02
5.5.290.0100.07317.93
5.5.280.0030.08720.82
5.5.270.0170.07320.89
5.5.260.0100.08320.95
5.5.250.0270.05020.63
5.5.240.3900.03020.14
5.4.450.0170.03019.41
5.4.440.0930.04719.21
5.4.430.0570.04019.27
5.4.420.0300.04319.41
5.4.410.0230.04019.36
5.4.400.0200.03718.93
5.4.390.0600.04018.91
5.4.380.0200.07318.60
5.4.370.0900.05718.59
5.4.360.0270.04018.55
5.4.350.0200.06018.51
5.4.340.0100.05718.52
5.4.320.0050.03612.48
5.4.310.0070.03712.47
5.4.300.0020.04612.47
5.4.290.0080.03512.47
5.4.280.0030.03812.37
5.4.270.0090.03912.37
5.4.260.0090.03512.37
5.4.250.0040.03912.37
5.4.240.0040.03712.37
5.4.230.0030.04012.36
5.4.220.0070.04512.36
5.4.210.0070.03412.36
5.4.200.0060.03812.36
5.4.190.0070.03612.36
5.4.180.0090.04512.36
5.4.170.0030.04012.37
5.4.160.0080.03512.37
5.4.150.0030.04012.36
5.4.140.0040.03812.05
5.4.130.0040.03612.04
5.4.120.0070.03711.99
5.4.110.0070.04111.98
5.4.100.0120.04811.98
5.4.90.0070.03711.99
5.4.80.0040.03911.99
5.4.70.0070.03311.98
5.4.60.0080.03211.98
5.4.50.0040.03611.98
5.4.40.0070.04011.97
5.4.30.0030.04311.96
5.4.20.0080.03711.96
5.4.10.0080.03211.97
5.4.00.0060.04111.46
5.3.290.0040.04012.80
5.3.280.0070.04312.71
5.3.270.0070.03912.72
5.3.260.0060.05212.72
5.3.250.0040.04712.72
5.3.240.0080.04112.72
5.3.230.0050.03712.71
5.3.220.0110.04212.68
5.3.210.0100.04012.68
5.3.200.0070.04712.68
5.3.190.0060.03812.68
5.3.180.0050.03712.67
5.3.170.0090.04212.67
5.3.160.0060.04812.67
5.3.150.0060.04312.67
5.3.140.0040.03812.66
5.3.130.0050.03912.66
5.3.120.0040.04012.66
5.3.110.0080.05612.66
5.3.100.0070.04012.12
5.3.90.0050.03712.09
5.3.80.0060.03512.08
5.3.70.0090.03312.08
5.3.60.0080.03512.07
5.3.50.0050.03612.03
5.3.40.0040.03712.01
5.3.30.0100.03111.97
5.3.20.0050.03611.75
5.3.10.0050.03411.71
5.3.00.0070.03411.70
5.2.170.0040.0319.21
5.2.160.0040.0309.21
5.2.150.0030.0329.21
5.2.140.0060.0299.21
5.2.130.0060.0379.17
5.2.120.0070.0269.17
5.2.110.0040.0299.17
5.2.100.0060.0279.17
5.2.90.0020.0349.17
5.2.80.0030.0319.16
5.2.70.0090.0339.17
5.2.60.0050.0329.11
5.2.50.0070.0289.09
5.2.40.0060.0279.06
5.2.30.0030.0379.04
5.2.20.0050.0309.03
5.2.10.0100.0308.95
5.2.00.0060.0308.80
5.1.60.0050.0248.09
5.1.50.0010.0288.09
5.1.40.0060.0228.07
5.1.30.0040.0278.42
5.1.20.0030.0288.44
5.1.10.0050.0258.16
5.1.00.0060.0318.17
5.0.50.0030.0266.66
5.0.40.0040.0186.52
5.0.30.0060.0356.33
5.0.20.0030.0286.30
5.0.10.0020.0226.27
5.0.00.0020.0376.27
4.4.90.0040.0244.78
4.4.80.0030.0144.76
4.4.70.0020.0164.76
4.4.60.0030.0154.75
4.4.50.0030.0154.77
4.4.40.0060.0254.71
4.4.30.0030.0154.76
4.4.20.0000.0184.84
4.4.10.0030.0154.85
4.4.00.0010.0264.76
4.3.110.0030.0154.67
4.3.100.0040.0214.66
4.3.90.0070.0264.63
4.3.80.0030.0234.58
4.3.70.0040.0174.63
4.3.60.0040.0204.63
4.3.50.0030.0194.63
4.3.40.0020.0244.54
4.3.30.0030.0153.32
4.3.20.0020.0213.31
4.3.10.0030.0143.26
4.3.00.0170.01715.29

preferences:
49.35 ms | 400 KiB | 5 Q