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(',', array('<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.50
8.3.50.0250.00421.93
8.3.40.0110.00418.71
8.3.30.0060.00919.13
8.3.20.0070.00020.35
8.3.10.0110.00421.85
8.3.00.0080.00017.93
8.2.180.0150.00316.75
8.2.170.0090.00622.96
8.2.160.0120.00320.48
8.2.150.0110.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00721.01
8.2.110.0000.01022.30
8.2.100.0000.01218.16
8.2.90.0000.00819.26
8.2.80.0080.00017.97
8.2.70.0000.01017.50
8.2.60.0030.00517.93
8.2.50.0060.00318.07
8.2.40.0070.00418.22
8.2.30.0070.00018.18
8.2.20.0000.00817.69
8.2.10.0080.00018.15
8.2.00.0040.00417.85
8.1.280.0030.01425.92
8.1.270.0080.00023.96
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00323.68
8.1.230.0090.00319.22
8.1.220.0030.00517.78
8.1.210.0030.00518.77
8.1.200.0120.00017.48
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0030.00518.73
8.1.160.0030.00521.97
8.1.150.0040.00418.96
8.1.140.0000.00917.54
8.1.130.0080.00017.86
8.1.120.0040.00417.53
8.1.110.0030.00517.38
8.1.100.0070.00017.39
8.1.90.0060.00317.50
8.1.80.0040.00417.36
8.1.70.0040.00417.48
8.1.60.0040.00417.58
8.1.50.0050.00317.59
8.1.40.0030.00517.45
8.1.30.0030.00517.71
8.1.20.0030.00617.63
8.1.10.0000.00817.52
8.1.00.0000.00717.51
8.0.300.0040.00418.77
8.0.290.0070.00017.00
8.0.280.0030.00318.49
8.0.270.0040.00417.21
8.0.260.0060.00017.25
8.0.250.0030.00317.10
8.0.240.0030.00317.08
8.0.230.0080.00016.98
8.0.220.0040.00416.91
8.0.210.0000.00717.05
8.0.200.0030.00317.11
8.0.190.0040.00416.95
8.0.180.0070.00016.98
8.0.170.0040.00416.92
8.0.160.0000.00717.04
8.0.150.0000.00716.96
8.0.140.0080.00016.85
8.0.130.0030.00313.38
8.0.120.0040.00416.91
8.0.110.0040.00416.96
8.0.100.0070.00016.95
8.0.90.0000.00816.81
8.0.80.0120.00316.99
8.0.70.0080.00016.90
8.0.60.0040.00416.93
8.0.50.0040.00416.94
8.0.30.0080.01317.04
8.0.20.0110.00917.40
8.0.10.0070.00016.96
8.0.00.0100.00716.79
7.4.330.0050.00015.00
7.4.320.0060.00016.49
7.4.300.0000.00616.48
7.4.290.0030.00316.53
7.4.280.0050.00316.63
7.4.270.0000.00716.64
7.4.260.0030.00316.42
7.4.250.0050.00316.61
7.4.240.0020.00516.50
7.4.230.0080.00016.53
7.4.220.0090.00916.64
7.4.210.0070.00716.59
7.4.200.0070.00016.45
7.4.160.0100.00616.64
7.4.150.0170.00617.40
7.4.140.0100.00817.86
7.4.130.0110.00816.58
7.4.120.0110.00516.68
7.4.110.0100.00716.49
7.4.100.0090.00916.72
7.4.90.0140.00316.53
7.4.80.0100.01019.39
7.4.70.0110.00916.82
7.4.60.0100.01016.47
7.4.50.0090.00016.27
7.4.40.0190.00316.51
7.4.30.0000.01516.71
7.4.10.0130.00714.75
7.4.00.0070.00814.88
7.3.330.0020.00213.26
7.3.320.0020.00213.27
7.3.310.0000.00716.33
7.3.300.0070.00016.34
7.3.290.0120.00816.32
7.3.280.0100.01116.39
7.3.270.0130.00317.40
7.3.260.0130.00616.46
7.3.250.0100.00816.54
7.3.240.0140.00416.54
7.3.230.0140.00316.47
7.3.210.0030.01316.33
7.3.200.0190.00019.39
7.3.190.0110.01116.37
7.3.180.0060.00916.28
7.3.170.0090.00916.58
7.3.160.0130.01016.48
7.3.130.0100.00614.88
7.3.120.0070.01114.98
7.3.110.0040.01414.93
7.3.100.0000.01614.67
7.3.90.0070.00714.89
7.3.80.0090.00915.00
7.3.70.0080.00714.92
7.3.60.0000.01314.70
7.3.50.0110.00414.71
7.3.40.0060.01214.70
7.3.30.0080.00414.94
7.3.20.0000.01416.46
7.3.10.0080.00416.66
7.3.00.0100.00316.82
7.2.330.0160.00616.62
7.2.320.0000.01816.45
7.2.310.0060.01016.75
7.2.300.0100.00716.50
7.2.290.0070.01016.75
7.2.260.0030.01414.79
7.2.250.0060.01315.14
7.2.240.0070.00715.13
7.2.230.0060.01215.17
7.2.220.0030.01714.96
7.2.210.0080.00415.06
7.2.200.0060.00314.73
7.2.190.0110.00415.17
7.2.180.0070.01015.08
7.2.170.0060.01315.09
7.2.160.0100.00015.13
7.2.150.0070.00716.97
7.2.140.0030.00616.93
7.2.130.0130.00016.61
7.2.120.0110.00716.90
7.2.110.0120.00316.73
7.2.100.0030.01316.95
7.2.90.0070.01016.92
7.2.80.0090.00617.02
7.2.70.0000.01016.81
7.2.60.0030.00716.82
7.2.50.0000.01417.02
7.2.40.0070.00717.03
7.2.30.0060.00616.95
7.2.20.0060.00916.97
7.2.10.0060.00916.94
7.2.00.0020.01318.14
7.1.330.0090.00615.87
7.1.320.0100.01015.70
7.1.310.0030.01015.84
7.1.300.0030.01015.80
7.1.290.0070.00715.60
7.1.280.0040.00415.61
7.1.270.0060.00615.43
7.1.260.0000.01015.69
7.1.250.0090.00615.84
7.1.240.0040.00815.99
7.1.230.0030.01015.97
7.1.220.0030.01015.99
7.1.210.0030.01015.80
7.1.200.0020.01115.69
7.1.190.0070.00315.59
7.1.180.0040.00415.77
7.1.170.0040.01115.84
7.1.160.0070.01015.79
7.1.150.0060.00615.57
7.1.140.0080.00615.88
7.1.130.0070.00315.94
7.1.120.0000.01815.95
7.1.110.0070.00715.98
7.1.100.0030.00915.83
7.1.90.0080.00615.52
7.1.80.0140.00015.79
7.1.70.0060.00616.51
7.1.60.0090.00616.57
7.1.50.0110.00816.37
7.1.40.0060.00615.94
7.1.30.0030.00715.85
7.1.20.0040.01115.95
7.1.10.0030.00615.68
7.1.00.0020.04719.09
7.0.330.0090.00015.13
7.0.320.0000.01115.36
7.0.310.0000.01315.49
7.0.300.0070.00715.25
7.0.290.0030.00615.53
7.0.280.0060.00615.38
7.0.270.0050.00515.35
7.0.260.0110.00015.41
7.0.250.0060.00315.29
7.0.240.0060.00915.11
7.0.230.0080.00415.52
7.0.220.0060.00615.63
7.0.210.0080.01015.14
7.0.200.0030.01316.20
7.0.190.0050.01015.19
7.0.180.0030.00915.45
7.0.170.0000.01415.46
7.0.160.0000.00815.41
7.0.150.0030.00915.16
7.0.140.0040.04018.71
7.0.130.0060.01215.45
7.0.120.0030.00715.37
7.0.110.0090.00315.37
7.0.100.0080.00415.52
7.0.90.0000.01015.56
7.0.80.0090.00015.43
7.0.70.0070.00715.50
7.0.60.0100.04018.45
7.0.50.0070.04016.72
7.0.40.0070.04816.72
7.0.30.0160.01816.72
7.0.20.0150.04516.83
7.0.10.0070.02816.87
7.0.00.0060.02616.87
5.6.400.0030.01014.26
5.6.390.0030.01014.49
5.6.380.0090.00614.26
5.6.370.0030.00614.33
5.6.360.0060.00614.25
5.6.350.0000.01013.97
5.6.340.0060.00914.34
5.6.330.0030.00614.59
5.6.320.0050.00514.05
5.6.310.0040.01214.37
5.6.300.0100.00314.42
5.6.290.0090.00014.41
5.6.280.0100.03817.75
5.6.270.0040.00814.19
5.6.260.0150.00014.20
5.6.250.0000.00914.46
5.6.240.0000.01414.63
5.6.230.0110.00414.59
5.6.220.0030.00914.43
5.6.210.0070.04417.41
5.6.200.0110.04216.33
5.6.190.0030.04317.47
5.6.180.0150.04417.42
5.6.170.0150.04517.43
5.6.160.0030.05017.38
5.6.150.0030.03716.12
5.6.140.0030.03716.33
5.6.130.0110.04216.20
5.6.120.0040.03117.75
5.6.110.0050.04717.72
5.6.100.0100.04417.58
5.6.90.0090.04217.72
5.6.80.0050.02517.36
5.6.70.0090.00614.04
5.6.60.0110.00713.93
5.6.50.0140.00314.54
5.6.40.0030.01014.00
5.6.30.0040.01114.34
5.6.20.0100.00314.30
5.6.10.0070.01014.25
5.6.00.0000.01314.05
5.5.380.0080.00214.31
5.5.370.0070.00714.46
5.5.360.0090.00314.32
5.5.350.0050.03217.30
5.5.340.0080.03616.06
5.5.330.0050.02717.44
5.5.320.0080.02017.27
5.5.310.0190.03617.39
5.5.300.0010.02616.26
5.5.290.0060.04516.05
5.5.280.0050.04617.48
5.5.270.0060.03217.60
5.5.260.0090.04517.46
5.5.250.0120.04217.37
5.5.240.0070.04317.00
5.5.230.0080.00314.22
5.5.220.0080.00614.20
5.5.210.0090.00614.30
5.5.200.0070.00714.17
5.5.190.0000.01514.23
5.5.180.0040.00414.30
5.5.170.0070.00714.29
5.5.160.0040.00814.16
5.5.150.0030.01414.04
5.5.140.0040.00714.34
5.5.130.0040.00414.33
5.5.120.0000.01214.09
5.5.110.0030.00613.96
5.5.100.0030.00714.28
5.5.90.0030.00714.18
5.5.80.0040.00714.25
5.5.70.0100.00313.82
5.5.60.0090.00314.39
5.5.50.0030.01014.12
5.5.40.0030.01014.40
5.5.30.0080.00614.06
5.5.20.0040.01114.34
5.5.10.0030.01413.66
5.5.00.0090.00014.27
5.4.450.0370.02015.20
5.4.440.0200.03115.26
5.4.430.0290.02215.23
5.4.420.0220.02615.11
5.4.410.0170.02415.24
5.4.400.0250.01515.08
5.4.390.0120.02614.93
5.4.380.0090.03714.90
5.4.370.0080.03014.63
5.4.360.0080.03114.81
5.4.350.0120.02714.80
5.4.340.0110.02814.69
5.4.330.0050.00311.10
5.4.320.0010.02511.71
5.4.310.0080.02011.70
5.4.300.0050.02011.55
5.4.290.0040.02211.50
5.4.280.0070.01811.79
5.4.270.0040.02111.57
5.4.260.0050.02211.71
5.4.250.0050.01911.66
5.4.240.0020.02311.51
5.4.230.0030.02311.57
5.4.220.0050.02011.56
5.4.210.0060.01811.64
5.4.200.0060.02211.66
5.4.190.0050.02211.64
5.4.180.0040.02511.56
5.4.170.0020.02311.76
5.4.160.0040.02111.61
5.4.150.0050.02111.71
5.4.140.0020.02611.49
5.4.130.0050.02111.51
5.4.120.0060.02111.40
5.4.110.0060.02111.38
5.4.100.0050.01911.57
5.4.90.0040.02511.49
5.4.80.0030.02911.42
5.4.70.0020.02211.42
5.4.60.0060.02111.45
5.4.50.0080.01911.54
5.4.40.0060.02111.49
5.4.30.0020.02411.51
5.4.20.0040.02211.55
5.4.10.0060.01611.46
5.4.00.0040.02411.09
5.3.290.0070.02111.71
5.3.280.0080.01911.59
5.3.270.0060.02211.63
5.3.260.0040.02411.61
5.3.250.0050.02011.68
5.3.240.0030.02111.47
5.3.230.0020.02411.48
5.3.220.0050.02011.51
5.3.210.0060.02111.56
5.3.200.0060.02111.54
5.3.190.0060.02011.43
5.3.180.0080.01911.60
5.3.170.0050.02011.60
5.3.160.0050.02611.63
5.3.150.0060.02211.57
5.3.140.0050.02011.60
5.3.130.0060.02111.49
5.3.120.0060.02111.56
5.3.110.0070.02011.60
5.3.100.0030.02311.25
5.3.90.0060.02011.33
5.3.80.0060.02111.12
5.3.70.0040.02411.19
5.3.60.0050.02011.29
5.3.50.0020.02311.09
5.3.40.0020.02511.22
5.3.30.0040.02011.20
5.3.20.0060.01911.03
5.3.10.0040.02111.00
5.3.00.0020.02210.96
5.2.170.0060.0289.21
5.2.160.0050.0289.21
5.2.150.0050.0309.21
5.2.140.0060.0299.21
5.2.130.0040.0369.16
5.2.120.0030.0309.17
5.2.110.0060.0299.17
5.2.100.0080.0269.17
5.2.90.0040.0309.17
5.2.80.0050.0319.17
5.2.70.0020.0339.17
5.2.60.0070.0289.12
5.2.50.0020.0339.08
5.2.40.0030.0309.06
5.2.30.0060.0409.04
5.2.20.0030.0309.03
5.2.10.0060.0278.95
5.2.00.0050.0308.81
5.1.60.0040.0248.09
5.1.50.0040.0268.09
5.1.40.0070.0228.07
5.1.30.0080.0228.42
5.1.20.0040.0288.44
5.1.10.0040.0268.16
5.1.00.0040.0268.18
5.0.50.0060.0186.66
5.0.40.0030.0196.52
5.0.30.0030.0356.33
5.0.20.0020.0286.30
5.0.10.0030.0226.28
5.0.00.0040.0326.27
4.4.90.0030.0164.78
4.4.80.0030.0164.76
4.4.70.0010.0184.76
4.4.60.0030.0164.75
4.4.50.0040.0154.77
4.4.40.0030.0264.71
4.4.30.0040.0154.76
4.4.20.0040.0184.84
4.4.10.0050.0194.85
4.4.00.0020.0264.76
4.3.110.0040.0144.67
4.3.100.0040.0144.66
4.3.90.0030.0154.63
4.3.80.0050.0264.58
4.3.70.0010.0164.63
4.3.60.0030.0154.63
4.3.50.0020.0164.63
4.3.40.0020.0254.54
4.3.30.0030.0153.33
4.3.20.0010.0173.31
4.3.10.0010.0173.26
4.3.00.0270.01715.29

preferences:
45.24 ms | 401 KiB | 5 Q