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.60.0090.00918.68
8.3.50.0090.01021.97
8.3.40.0110.00418.97
8.3.30.0120.00319.04
8.3.20.0000.00820.13
8.3.10.0090.00023.65
8.3.00.0150.00020.63
8.2.180.0120.00616.75
8.2.170.0060.00922.96
8.2.160.0000.01322.21
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0070.00020.69
8.2.110.0100.00020.53
8.2.100.0030.00917.91
8.2.90.0000.00819.79
8.2.80.0050.00319.31
8.2.70.0050.00317.75
8.2.60.0000.00817.75
8.2.50.0030.00618.16
8.2.40.0040.00419.35
8.2.30.0060.00319.39
8.2.20.0050.00317.91
8.2.10.0080.00017.88
8.2.00.0050.00318.03
8.1.280.0090.00925.92
8.1.270.0060.00323.96
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00920.90
8.1.230.0050.00520.96
8.1.220.0060.00317.89
8.1.210.0040.00418.77
8.1.200.0060.00317.61
8.1.190.0000.00817.37
8.1.180.0040.00419.14
8.1.170.0080.00017.62
8.1.160.0000.00719.06
8.1.150.0050.00320.39
8.1.140.0040.00417.59
8.1.130.0000.00717.80
8.1.120.0000.00717.49
8.1.110.0030.00617.59
8.1.100.0000.00817.53
8.1.90.0000.00717.63
8.1.80.0000.00717.49
8.1.70.0000.00717.53
8.1.60.0060.00317.77
8.1.50.0050.00317.55
8.1.40.0050.00317.68
8.1.30.0080.00017.74
8.1.20.0000.00817.66
8.1.10.0000.00717.55
8.1.00.0040.00417.63
8.0.300.0040.00419.91
8.0.290.0040.00416.88
8.0.280.0030.00318.63
8.0.270.0000.00717.38
8.0.260.0030.00316.97
8.0.250.0000.00717.18
8.0.240.0040.00417.21
8.0.230.0000.00717.21
8.0.220.0030.00317.00
8.0.210.0050.00217.00
8.0.200.0030.00317.20
8.0.190.0040.00417.14
8.0.180.0000.00717.00
8.0.170.0000.00816.99
8.0.160.0020.00516.99
8.0.150.0040.00417.02
8.0.140.0000.00716.96
8.0.130.0000.00613.44
8.0.120.0030.00617.10
8.0.110.0000.00917.20
8.0.100.0110.00017.34
8.0.90.0030.00717.20
8.0.80.0120.00817.19
8.0.70.0000.00917.29
8.0.60.0000.00917.27
8.0.50.0000.00917.27
8.0.30.0080.01417.56
8.0.20.0150.00917.60
8.0.10.0060.00317.24
8.0.00.0090.01317.05
7.4.330.0060.00015.06
7.4.320.0030.00316.71
7.4.300.0040.00216.68
7.4.290.0000.00716.56
7.4.280.0040.00416.63
7.4.270.0040.00416.66
7.4.260.0080.00016.71
7.4.250.0030.00716.74
7.4.240.0010.00716.86
7.4.230.0060.00316.90
7.4.220.0040.01816.73
7.4.210.0070.01816.77
7.4.200.0030.00616.92
7.4.190.0060.00317.01
7.4.160.0080.01216.76
7.4.150.0120.00917.40
7.4.140.0140.00817.86
7.4.130.0070.01716.71
7.4.120.0130.00916.71
7.4.110.0040.01616.90
7.4.100.0120.00916.64
7.4.90.0090.01716.69
7.4.80.0120.00918.13
7.4.70.0100.01016.78
7.4.60.0090.01516.67
7.4.50.0120.01116.64
7.4.40.0090.01218.76
7.4.30.0180.00916.57
7.4.20.0180.00716.56
7.4.10.0100.01616.66
7.4.00.0120.00916.26
7.3.330.0050.00013.39
7.3.320.0000.00613.27
7.3.310.0000.00916.52
7.3.300.0060.00316.55
7.3.290.0070.01116.73
7.3.280.0090.01116.73
7.3.270.0120.01517.40
7.3.260.0050.01616.80
7.3.250.0140.00616.71
7.3.240.0090.01816.80
7.3.230.0100.01016.70
7.3.220.0060.01716.67
7.3.210.0080.01516.81
7.3.200.0100.01516.87
7.3.190.0090.01316.72
7.3.180.0170.01016.77
7.3.170.0140.00916.78
7.3.160.0120.01316.76
7.3.150.0120.01316.78
7.3.140.0140.01016.75
7.3.130.0120.01216.72
7.3.120.0100.01316.24
7.3.110.0080.01616.71
7.3.100.0090.01716.61
7.3.90.0070.01716.78
7.3.80.0090.01716.72
7.3.70.0080.01216.64
7.3.60.0130.00816.59
7.3.50.0140.00816.65
7.3.40.0080.01516.62
7.3.30.0090.01516.65
7.3.20.0140.00817.57
7.3.10.0090.01717.48
7.3.00.0160.00917.66
7.2.330.0090.01416.94
7.2.320.0040.01716.84
7.2.310.0120.01416.87
7.2.300.0080.01616.68
7.2.290.0100.01316.93
7.2.280.0110.01416.77
7.2.270.0170.00916.60
7.2.260.0090.01716.84
7.2.250.0040.02117.01
7.2.240.0160.01116.80
7.2.230.0070.01616.95
7.2.220.0120.01316.72
7.2.210.0150.01116.85
7.2.200.0100.01216.80
7.2.190.0080.01416.85
7.2.180.0080.01516.73
7.2.170.0110.01016.85
7.2.160.0040.01916.81
7.2.150.0180.00717.73
7.2.140.0140.00917.68
7.2.130.0140.01317.66
7.2.120.0070.02016.81
7.2.110.0130.01017.83
7.2.100.0140.01317.73
7.2.90.0170.01117.59
7.2.80.0110.01217.74
7.2.70.0140.01217.78
7.2.60.0090.01517.56
7.2.50.0100.01517.65
7.2.40.0420.01016.89
7.2.30.0120.01716.88
7.2.20.0140.01117.74
7.2.10.0140.01217.67
7.2.00.0110.01018.34
7.1.330.0320.00916.81
7.1.320.0190.01415.84
7.1.310.0160.01716.83
7.1.300.0150.01916.84
7.1.290.0200.01415.91
7.1.280.0270.00916.78
7.1.270.0190.01916.71
7.1.260.0300.02016.80
7.1.250.0270.01316.74
7.1.240.0200.01316.77
7.1.230.0200.01716.71
7.1.220.0200.01216.68
7.1.210.0130.01616.78
7.1.200.0160.01016.44
7.1.190.0210.01516.73
7.1.180.0190.01316.64
7.1.170.0180.01116.63
7.1.160.0160.01215.91
7.1.150.0220.01015.69
7.1.140.0190.01416.63
7.1.130.0210.01015.78
7.1.120.0280.00916.68
7.1.110.0170.01816.76
7.1.100.0160.01617.33
7.1.90.0220.00816.73
7.1.80.0300.00716.67
7.1.70.0180.00616.95
7.1.60.0130.01417.06
7.1.50.0180.00816.91
7.1.40.0110.01316.80
7.1.30.0130.01216.90
7.1.20.0100.01616.31
7.1.10.0150.00716.76
7.1.00.0150.01216.79
7.0.330.0240.01116.45
7.0.320.0500.01516.45
7.0.310.0200.01516.38
7.0.300.0240.00816.34
7.0.290.0180.01616.35
7.0.280.0300.01216.40
7.0.270.0220.01315.40
7.0.260.0200.01416.26
7.0.250.0200.01116.30
7.0.240.0180.01216.37
7.0.230.0100.01516.40
7.0.220.0120.01616.38
7.0.210.0210.01116.40
7.0.200.0140.01216.72
7.0.190.0120.01116.59
7.0.180.0130.01016.44
7.0.170.0130.01216.45
7.0.160.0090.01316.43
7.0.150.0180.01016.54
7.0.140.0140.01216.54
7.0.130.0160.00916.51
7.0.120.0190.01216.58
7.0.110.0150.01116.44
7.0.100.0140.01316.45
7.0.90.0110.01216.47
7.0.80.0140.01216.54
7.0.70.0130.01416.61
7.0.60.0410.01316.31
7.0.50.0120.01116.38
7.0.40.0300.01215.87
7.0.30.0210.01215.83
7.0.20.0210.01115.34
7.0.10.0210.01015.87
7.0.00.0170.01315.83
5.6.400.0270.00916.11
5.6.390.0190.01516.18
5.6.380.0220.01616.28
5.6.370.0260.01116.24
5.6.360.0230.01116.25
5.6.350.0150.01716.22
5.6.340.0160.01616.19
5.6.330.0260.01316.03
5.6.320.0220.01316.36
5.6.310.0230.01416.23
5.6.300.0150.02017.88
5.6.290.0130.02817.73
5.6.280.0120.02517.89
5.6.270.0180.02517.78
5.6.260.0140.02517.88
5.6.250.0100.02917.91
5.6.240.0120.02517.85
5.6.230.0150.02617.77
5.6.220.0140.02617.81
5.6.210.0140.02517.83
5.6.200.0130.02817.79
5.6.190.0190.02317.70
5.6.180.0170.02317.81
5.6.170.0150.02817.72
5.6.160.0130.02917.80
5.6.150.0130.02717.64
5.6.140.0170.02717.74
5.6.130.0180.02717.90
5.6.120.0200.02317.91
5.6.110.0110.03517.79
5.6.100.0210.02117.74
5.6.90.0180.03817.82
5.6.80.0120.03017.55
5.6.70.0120.02317.63
5.6.60.0120.02517.59
5.6.50.0160.02617.51
5.6.40.0170.02417.43
5.6.30.0170.02417.59
5.6.20.0140.03317.40
5.6.10.0190.02317.44
5.6.00.0160.02617.48
5.5.380.0140.02416.62
5.5.370.0160.02516.68
5.5.360.0130.02716.50
5.5.350.0180.03216.56
5.5.340.0120.02916.81
5.5.330.0130.02716.79
5.5.320.0260.02516.90
5.5.310.0170.02416.82
5.5.300.0150.02416.81
5.5.290.0120.02516.77
5.5.280.0130.02816.94
5.5.270.0200.03116.95
5.5.260.0170.03216.78
5.5.250.0160.02516.70
5.5.240.0170.02816.62
5.5.230.0080.03016.59
5.5.220.0070.03116.51
5.5.210.0140.02316.51
5.5.200.0180.02116.62
5.5.190.0090.02716.48
5.5.180.0130.03116.56
5.5.170.0200.01616.08
5.5.160.0140.02216.54
5.5.150.0230.02616.63
5.5.140.0200.03316.64
5.5.130.0150.02516.53
5.5.120.0210.02116.52
5.5.110.0140.02616.60
5.5.100.0130.03616.49
5.5.90.0150.03116.51
5.5.80.0090.03016.55
5.5.70.0140.02316.50
5.5.60.0100.02616.39
5.5.50.0160.02116.49
5.5.40.0130.02816.52
5.5.30.0140.02116.46
5.5.20.0160.02016.50
5.5.10.0120.02216.57
5.5.00.0150.02416.48
5.4.450.0150.01714.99
5.4.440.0110.02114.98
5.4.430.0130.02115.08
5.4.420.0120.01715.09
5.4.410.0080.02415.04
5.4.400.0100.02214.81
5.4.390.0090.02314.85
5.4.380.0150.01614.95
5.4.370.0140.01914.77
5.4.360.0130.01814.96
5.4.350.0130.02014.92
5.4.340.0090.02514.83
5.4.330.0180.00512.77
5.4.320.0130.03014.91
5.4.310.0160.01714.81
5.4.300.0080.03214.87
5.4.290.0130.01914.91
5.4.280.0140.01914.92
5.4.270.0120.01914.86
5.4.260.0150.02814.88
5.4.250.0120.01814.91
5.4.240.0100.02614.86
5.4.230.0090.02114.74
5.4.220.0150.02414.86
5.4.210.0110.02314.85
5.4.200.0140.02114.85
5.4.190.0120.02614.93
5.4.180.0100.02214.75
5.4.170.0130.01714.98
5.4.160.0180.01514.84
5.4.150.0130.01514.94
5.4.140.0120.01914.13
5.4.130.0080.02113.98
5.4.120.0090.01713.95
5.4.110.0140.01614.16
5.4.100.0120.01614.09
5.4.90.0100.01914.09
5.4.80.0100.01714.19
5.4.70.0100.02114.04
5.4.60.0130.01514.11
5.4.50.0060.01814.11
5.4.40.0080.02014.07
5.4.30.0120.01614.08
5.4.20.0120.01314.02
5.4.10.0100.01914.02
5.4.00.0110.02013.86
5.3.290.0120.02613.91
5.3.280.0090.03513.80
5.3.270.0090.02313.88
5.3.260.0140.02113.98
5.3.250.0170.02913.86
5.3.240.0150.01813.86
5.3.230.0110.02313.83
5.3.220.0080.02313.87
5.3.210.0130.02213.88
5.3.200.0140.03213.82
5.3.190.0090.02313.91
5.3.180.0110.02813.97
5.3.170.0140.02113.89
5.3.160.0110.01913.93
5.3.150.0090.02313.92
5.3.140.0100.02213.92
5.3.130.0110.02313.81
5.3.120.0120.02413.85
5.3.110.0170.01913.94
5.3.100.0090.02013.95
5.3.90.0070.02313.86
5.3.80.0110.02413.74
5.3.70.0100.02113.78
5.3.60.0110.02113.84
5.3.50.0090.02413.84
5.3.40.0160.01913.80
5.3.30.0120.03113.79
5.3.20.0120.02113.80
5.3.10.0150.02013.75
5.3.00.0100.02913.66

preferences:
50.34 ms | 400 KiB | 5 Q