3v4l.org

run code in 300+ PHP versions simultaneously
<?php function output_delimiter() { echo "\n-----------------------------------------------------------------------------\n\n"; } /* * It decodes strings containig encoded words by following the steps below * 1) Remove MIME header line breaks. * 2) Decode encoded words by isolating pure encoded words and * decode them with imap_utf8 * * @param $str */ function imap_utf8_wrapper($str) { $str=preg_replace('/\r\n\s/', "", $str); return preg_replace_callback('/=\?[^?]+\?(?:Q|B)\?[^?]+\?=/', function($matches) { return imap_utf8($matches[0]); }, $str); } function imap_mime_header_decode_wrapper($str) { $arr=imap_mime_header_decode($str); $ret=""; foreach($arr as $elem) { if($elem->charset == 'default') $ret.=$elem->text; else $ret.=iconv($elem->charset, "UTF-8", $elem->text); } return $ret; } function decode_suite($str) { echo " iconv_mime_decode : ".iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, "UTF-8")."\n"; echo " mb_decode_mimeheader : ".mb_decode_mimeheader($str)."\n"; echo " imap_utf8_wrapper : ".imap_utf8_wrapper($str)."\n"; echo " imap_mime_header_decode : ".imap_mime_header_decode_wrapper($str)."\n"; } function mime_encoding_decoding_test($str, $encode_method, $func) { $str=$func($str); echo "After $encode_method : $str\n\n"; decode_suite($str); output_delimiter(); } function execute_test($str) { echo "\nBefore encoding : ".$str."\n"; output_delimiter(); $mime_test=function ($encode_method, $func) use ($str) { mime_encoding_decoding_test($str, $encode_method, $func); }; $prefs = array ("scheme" => "Q", "input-charset" => "utf-8", "output-charset" => "utf-8", "line-break-chars" => "\r\n"); $mime_test("iconv_mime_encode Q", function($str) use ($prefs) { return iconv_mime_encode('From', $str, $prefs); }); $prefs['scheme']="B"; $mime_test("iconv_mime_encode B", function($str) use ($prefs) { return iconv_mime_encode('From', $str, $prefs); }); $mime_test("mb_encode_mimeheader Q", function($str) { return mb_encode_mimeheader($str, "UTF-8", "Q"); }); $mime_test("mb_encode_mimeheader B", function($str) { return mb_encode_mimeheader($str, "UTF-8", "B"); }); } $str='"Réal Namé" <user@example.com>'; #$str='안녕 <user@example.com>'; mb_internal_encoding("UTF-8"); execute_test($str); ?>

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.0060.00919.06
8.3.30.0000.01418.92
8.3.20.0040.00418.85
8.3.10.0040.00420.61
8.3.00.0060.00317.75
8.2.170.0000.01422.96
8.2.160.0150.00022.21
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00819.96
8.2.110.0060.00320.52
8.2.100.0040.00818.16
8.2.90.0040.00419.53
8.2.80.0050.00318.13
8.2.70.0090.00017.88
8.2.60.0000.00818.04
8.2.50.0030.00618.07
8.2.40.0040.00418.34
8.2.30.0060.00318.22
8.2.20.0050.00317.91
8.2.10.0030.00518.03
8.2.00.0040.00418.09
8.1.270.0060.00324.66
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00322.21
8.1.230.0040.00817.60
8.1.220.0040.00417.80
8.1.210.0030.00518.77
8.1.200.0070.00317.60
8.1.190.0000.00817.76
8.1.180.0050.00318.10
8.1.170.0040.00419.01
8.1.160.0000.00818.89
8.1.150.0050.00318.93
8.1.140.0040.00417.68
8.1.130.0000.00717.90
8.1.120.0040.00417.71
8.1.110.0050.00217.73
8.1.100.0030.00517.64
8.1.90.0070.00017.77
8.1.80.0070.00017.64
8.1.70.0040.00417.73
8.1.60.0050.00317.75
8.1.50.0050.00317.68
8.1.40.0000.00917.82
8.1.30.0080.00017.90
8.1.20.0090.00018.00
8.1.10.0060.00317.90
8.1.00.0030.00517.73
8.0.300.0060.00318.77
8.0.290.0040.00416.88
8.0.280.0040.00418.52
8.0.270.0000.00717.34
8.0.260.0040.00417.14
8.0.250.0000.00817.27
8.0.240.0060.00317.37
8.0.230.0040.00417.27
8.0.220.0030.00317.22
8.0.210.0040.00417.21
8.0.200.0030.00317.26
8.0.190.0040.00417.17
8.0.180.0030.00517.20
8.0.170.0060.00317.11
8.0.160.0000.00717.20
8.0.150.0000.00917.10
8.0.140.0040.00417.20
8.0.130.0000.00613.36
8.0.120.0060.00617.16
8.0.110.0000.00917.28
8.0.100.0000.00917.42
8.0.90.0000.00917.36
8.0.80.0120.00617.37
8.0.70.0060.00317.43
8.0.60.0000.00917.21
8.0.50.0030.00617.21
8.0.30.0130.00917.45
8.0.20.0110.01417.47
8.0.10.0060.00317.42
8.0.00.0130.01017.37
7.4.330.0050.00013.03
7.4.320.0040.00416.75
7.4.300.0030.00316.85
7.4.290.0040.00416.82
7.4.280.0000.00916.90
7.4.270.0040.00416.86
7.4.260.0000.00513.26
7.4.250.0000.01116.89
7.4.240.0050.00517.07
7.4.230.0050.00517.04
7.4.220.0080.02517.07
7.4.210.0100.01117.02
7.4.200.0040.00417.05
7.4.190.0060.00316.98
7.4.160.0130.00616.84
7.4.150.0120.01716.86
7.4.140.0140.01017.00
7.4.130.0050.01616.97
7.4.120.0060.01416.97
7.4.110.0070.02017.03
7.4.100.0170.00916.95
7.4.90.0150.01216.73
7.4.80.0150.01419.39
7.4.70.0080.01316.98
7.4.60.0070.01316.92
7.4.50.0050.00916.94
7.4.40.0050.01416.82
7.4.30.0090.01217.15
7.4.20.0000.02016.96
7.4.10.0120.01816.68
7.4.00.0100.01016.27
7.3.330.0000.00613.27
7.3.320.0060.00013.39
7.3.310.0060.00316.88
7.3.300.0040.00416.84
7.3.290.0170.00716.81
7.3.280.0080.01316.76
7.3.270.0100.01316.84
7.3.260.0100.01216.97
7.3.250.0100.01316.81
7.3.240.0030.02117.02
7.3.230.0090.00916.84
7.3.210.0060.01316.80
7.3.200.0090.00917.08
7.3.190.0110.01116.86
7.3.180.0070.01416.92
7.3.170.0090.01516.93
7.3.160.0120.01316.89
7.3.150.0120.01616.82
7.3.140.0100.01316.74
7.3.130.0060.02216.84
7.3.120.0060.01416.03
7.3.110.0060.01516.91
7.3.100.0120.00816.86
7.3.90.0150.00617.07
7.3.80.0080.01416.83
7.3.70.0070.01516.88
7.3.60.0130.00916.86
7.3.50.0000.02116.88
7.3.40.0030.01616.91
7.3.30.0070.01416.99
7.3.20.0050.01616.72
7.3.10.0070.01916.82
7.3.00.0000.01916.69
7.2.330.0090.01217.07
7.2.320.0070.02017.10
7.2.310.0110.01017.11
7.2.300.0110.01017.04
7.2.290.0110.01217.13
7.2.280.0110.01016.74
7.2.270.0090.01817.09
7.2.260.0030.01916.70
7.2.250.0110.01117.19
7.2.240.0000.02217.03
7.2.230.0090.01417.11
7.2.220.0170.00517.05
7.2.210.0070.01317.12
7.2.200.0090.01417.08
7.2.190.0110.00816.79
7.2.180.0090.01316.81
7.2.170.0050.01616.93
7.2.160.0140.00717.00
7.2.150.0100.01916.89
7.2.140.0110.01616.93
7.2.130.0090.01316.94
7.2.120.0080.01517.03
7.2.110.0180.01017.03
7.2.100.0180.00617.00
7.2.90.0090.01917.08
7.2.80.0070.02117.08
7.2.70.0130.01017.12
7.2.60.0110.01117.01
7.2.50.0090.01317.12
7.2.40.0100.01716.96
7.2.30.0620.02117.15
7.2.20.0140.01416.98
7.2.10.0090.01817.02
7.2.00.0110.01418.32
7.1.330.0280.01316.06
7.1.320.0110.02216.03
7.1.310.0270.00516.25
7.1.300.0300.00916.07
7.1.290.0430.00516.14
7.1.280.0300.00316.22
7.1.270.0210.01215.95
7.1.260.0180.01315.99
7.1.250.0270.00715.99
7.1.240.0200.01515.86
7.1.230.0230.01015.94
7.1.220.0090.02315.87
7.1.210.0310.00715.94
7.1.200.0180.00716.06
7.1.190.0380.01016.16
7.1.180.0240.00916.04
7.1.170.0260.01315.92
7.1.160.0330.01016.03
7.1.150.0220.02315.91
7.1.140.0200.02116.06
7.1.130.0280.01315.87
7.1.120.0340.00615.95
7.1.110.0300.01215.96
7.1.100.0160.01117.38
7.1.90.0270.01315.92
7.1.80.0320.01216.16
7.1.70.0140.01616.65
7.1.60.0180.01417.76
7.1.50.0190.01516.69
7.1.40.0270.01916.16
7.1.30.0210.01716.05
7.1.20.0340.00816.19
7.1.10.0380.01916.13
7.1.00.0190.04019.21
7.0.330.0290.01215.48
7.0.320.0200.01615.41
7.0.310.0210.01815.63
7.0.300.0210.01815.80
7.0.290.0100.02915.81
7.0.280.0190.02515.58
7.0.270.0150.02515.84
7.0.260.0340.01815.72
7.0.250.0290.01415.65
7.0.240.0180.02215.93
7.0.230.0290.01215.69
7.0.220.0240.01415.69
7.0.210.0180.01815.81
7.0.200.0380.01115.52
7.0.190.0290.01215.71
7.0.180.0250.01515.75
7.0.170.0250.01315.73
7.0.160.0170.02315.82
7.0.150.0300.00315.88
7.0.140.0110.04819.01
7.0.130.0210.01615.55
7.0.120.0180.03818.99
7.0.110.0170.01415.64
7.0.100.0160.01615.76
7.0.90.0110.02515.78
7.0.80.0250.00915.69
7.0.70.0130.01715.71
7.0.60.0170.04117.88
7.0.50.0180.03316.86
7.0.40.0170.02517.96
7.0.30.0260.02517.96
7.0.20.0220.03317.97
7.0.10.0100.02818.02
7.0.00.0130.04918.02
5.6.400.0270.00616.11
5.6.390.0230.01516.16
5.6.380.0170.02016.06
5.6.370.0240.02116.38
5.6.360.0200.02016.11
5.6.350.0170.02216.38
5.6.340.0410.00616.47
5.6.330.0240.01716.11
5.6.320.0270.01216.45
5.6.310.0310.01016.39
5.6.300.0230.01515.86
5.6.290.0210.01216.25
5.6.280.0180.04118.90
5.6.270.0230.01016.05
5.6.260.0180.01516.25
5.6.250.0120.02516.29
5.6.240.0220.01416.50
5.6.230.0190.01616.38
5.6.220.0160.01616.40
5.6.210.0110.03818.36
5.6.200.0160.03117.32
5.6.190.0150.02718.40
5.6.180.1910.02918.56
5.6.170.0290.02918.48
5.6.160.0150.03018.31
5.6.150.0100.04217.30
5.6.140.0150.02917.31
5.6.130.0100.03317.35
5.6.120.0130.03718.75
5.6.110.0120.04518.73
5.6.100.0090.02918.70
5.6.90.0210.04618.71
5.6.80.0160.04618.26
5.6.70.0210.01516.23
5.6.60.0130.01916.19
5.6.50.0140.02116.05
5.6.40.0240.00816.11
5.6.30.0220.01816.23
5.6.20.0200.01316.21
5.6.10.0170.01716.10
5.6.00.0140.01716.13
5.5.380.0190.01916.21
5.5.370.0310.00516.27
5.5.360.0240.00716.03
5.5.350.0290.04318.27
5.5.340.0130.03117.20
5.5.330.0050.03618.43
5.5.320.0270.03818.32
5.5.310.0270.03018.49
5.5.300.0180.04117.16
5.5.290.0150.04617.06
5.5.280.0210.03118.57
5.5.270.0140.02818.66
5.5.260.0140.05018.60
5.5.250.0090.05118.57
5.5.240.0100.02818.16
5.5.230.0180.01816.01
5.5.220.0120.01916.21
5.5.210.0170.01416.25
5.5.200.0120.02116.27
5.5.190.0160.02016.22
5.5.180.0220.01216.13
5.5.170.0170.01416.16
5.5.160.0200.01216.04
5.5.150.0110.02216.18
5.5.140.0120.02016.18
5.5.130.0120.02416.10
5.5.120.0250.00916.13
5.5.110.0280.00716.14
5.5.100.0230.01016.24
5.5.90.0230.01116.24
5.5.80.0160.01515.99
5.5.70.0280.01216.18
5.5.60.0150.01816.04
5.5.50.0170.02016.07
5.5.40.0180.01515.95
5.5.30.0300.00516.07
5.5.20.0250.00816.20
5.5.10.0100.02216.14
5.5.00.0210.00916.15
5.4.450.0060.02816.26
5.4.440.0140.02016.21
5.4.430.0150.03116.09
5.4.420.0080.04116.18
5.4.410.0120.03816.12
5.4.400.0120.02015.95
5.4.390.0100.02415.91
5.4.380.0120.02015.88
5.4.370.0110.04415.96
5.4.360.0050.02716.12
5.4.350.0070.04715.98
5.4.340.0100.02415.83
5.4.330.0150.00712.52
5.4.320.0090.02515.97
5.4.310.0130.02415.99
5.4.300.0130.01815.98
5.4.290.0090.02315.88
5.4.280.0130.02015.76
5.4.270.0110.03015.94
5.4.260.0080.03115.93
5.4.250.0100.02315.85
5.4.240.0120.02315.97
5.4.230.0110.02415.91
5.4.220.0080.03815.95
5.4.210.0100.02915.79
5.4.200.0120.02215.87
5.4.190.0100.02316.08
5.4.180.0110.03215.75
5.4.170.0160.02115.99
5.4.160.0080.04015.99
5.4.150.0120.03015.95
5.4.140.0170.03314.57
5.4.130.0100.02114.63
5.4.120.0080.02414.59
5.4.110.0100.02014.65
5.4.100.0070.02714.50
5.4.90.0080.04614.61
5.4.80.0100.02214.65
5.4.70.0080.02514.72
5.4.60.0110.02914.62
5.4.50.0140.01714.69
5.4.40.0060.03114.57
5.4.30.0110.02414.70
5.4.20.0080.02314.60
5.4.10.0110.02014.63
5.4.00.0130.02314.44
5.3.290.0160.04114.26
5.3.280.0130.04814.03
5.3.270.0100.02814.09
5.3.260.0110.02414.05
5.3.250.0110.02514.22
5.3.240.0130.02314.08
5.3.230.0090.02514.05
5.3.220.0100.03114.15
5.3.210.0160.02214.14
5.3.200.0080.04714.04
5.3.190.0140.02514.20
5.3.180.0100.03314.08
5.3.170.0090.02614.12
5.3.160.0120.02614.09
5.3.150.0090.02414.12
5.3.140.0120.02414.11
5.3.130.0130.02214.04
5.3.120.0130.02414.04
5.3.110.0180.02014.09
5.3.100.0090.02713.78
5.3.90.0140.04213.96
5.3.80.0160.03913.74
5.3.70.0080.02513.66
5.3.60.0100.03013.72
5.3.50.0060.02713.76
5.3.40.0120.04513.79
5.3.30.0100.02713.74
5.3.20.0060.02813.57
5.3.10.0090.02713.62
5.3.00.0060.02613.48
5.2.170.0070.03211.53
5.2.160.0070.01911.53
5.2.150.0030.02311.48
5.2.140.0080.01711.47
5.2.130.0040.02111.53
5.2.120.0070.01911.48
5.2.110.0060.01911.53
5.2.100.0090.01511.53
5.2.90.0040.02011.53
5.2.80.0070.01911.53
5.2.70.0060.01911.46
5.2.60.0090.01511.47
5.2.50.0080.01611.48
5.2.40.0060.01911.48
5.2.30.0040.02011.53
5.2.20.0110.01411.41
5.2.10.0050.01911.39
5.2.00.0070.02011.39
5.1.60.0060.01410.94
5.1.50.0090.01310.95
5.1.40.0050.01410.94
5.1.30.0040.01911.13
5.1.20.0080.02011.11
5.1.10.0080.01310.98
5.1.00.0040.01711.06
5.0.50.0100.00810.73
5.0.40.0020.01610.73
5.0.30.0040.01810.73
5.0.20.0100.01010.73
5.0.10.0040.01710.73
5.0.00.0050.01610.73
4.4.90.0040.01310.73
4.4.80.0060.00710.73
4.4.70.0030.01110.73
4.4.60.0000.01310.73
4.4.50.0000.01210.73
4.4.40.0020.01410.73
4.4.30.0050.00810.73
4.4.20.0050.01010.73
4.4.10.0040.01010.73
4.4.00.0050.01210.73
4.3.110.0030.01010.73
4.3.100.0020.01110.73
4.3.90.0040.00710.73
4.3.80.0050.01310.73
4.3.70.0050.00810.73
4.3.60.0040.00810.73
4.3.50.0010.01110.73
4.3.40.0030.01310.73
4.3.30.0020.00910.73
4.3.20.0050.00810.73
4.3.10.0020.00910.73
4.3.00.0040.00710.73

preferences:
45.94 ms | 400 KiB | 5 Q