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='=?utf-8?B?Q3Vyc28gZGUgVmlwYXNzYW5hOiBTdSBpbnNjcmlwY2nDs24gaGEgc2lkbyBjYW5jZWxhZGE=?='; #$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.0110.00718.28
8.3.50.0080.01122.03
8.3.40.0110.00418.84
8.3.30.0140.00719.23
8.3.20.0080.00020.33
8.3.10.0000.00823.48
8.3.00.0060.00317.66
8.2.180.0120.00318.36
8.2.170.0180.00022.96
8.2.160.0030.01020.57
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0000.00826.16
8.2.120.0050.00220.88
8.2.110.0060.00320.51
8.2.100.0000.01217.84
8.2.90.0040.00419.36
8.2.80.0040.00417.97
8.2.70.0070.00417.63
8.2.60.0040.00418.03
8.2.50.0030.00718.07
8.2.40.0080.00018.26
8.2.30.0050.00518.32
8.2.20.0080.00017.75
8.2.10.0000.00919.85
8.2.00.0040.00417.99
8.1.280.0070.01125.92
8.1.270.0030.00523.84
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00723.89
8.1.230.0030.00922.24
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0080.00017.48
8.1.180.0000.00818.10
8.1.170.0050.00318.84
8.1.160.0070.00022.15
8.1.150.0030.00619.05
8.1.140.0080.00017.63
8.1.130.0000.00717.94
8.1.120.0040.00417.53
8.1.110.0000.00817.64
8.1.100.0070.00017.48
8.1.90.0030.00417.49
8.1.80.0040.00417.58
8.1.70.0030.00317.45
8.1.60.0080.00017.64
8.1.50.0060.00317.53
8.1.40.0000.00817.58
8.1.30.0080.00017.71
8.1.20.0000.00817.81
8.1.10.0000.00817.76
8.1.00.0050.00317.53
8.0.300.0070.00018.77
8.0.290.0070.00016.88
8.0.280.0070.00018.64
8.0.270.0000.00817.43
8.0.260.0000.00717.46
8.0.250.0000.00717.16
8.0.240.0030.00517.14
8.0.230.0040.00417.14
8.0.220.0050.00317.13
8.0.210.0000.00717.09
8.0.200.0070.00017.16
8.0.190.0030.00617.16
8.0.180.0050.00217.18
8.0.170.0040.00417.15
8.0.160.0040.00417.08
8.0.150.0000.00717.12
8.0.140.0040.00417.09
8.0.130.0060.00013.40
8.0.120.0060.00317.22
8.0.110.0000.00917.21
8.0.100.0030.00617.17
8.0.90.0030.00617.05
8.0.80.0100.01017.16
8.0.70.0040.00717.12
8.0.60.0030.00717.24
8.0.50.0050.00517.05
8.0.30.0090.01417.27
8.0.20.0110.01317.46
8.0.10.0030.00617.34
8.0.00.0110.00817.07
7.4.330.0020.00215.00
7.4.320.0030.00316.77
7.4.300.0080.00016.61
7.4.290.0070.00016.72
7.4.280.0040.00416.52
7.4.270.0070.00016.64
7.4.260.0030.00316.58
7.4.250.0030.00716.84
7.4.240.0060.00316.81
7.4.230.0090.00016.90
7.4.220.0100.01316.72
7.4.210.0070.01016.82
7.4.200.0030.00616.88
7.4.160.0170.00316.76
7.4.150.0140.01417.40
7.4.140.0090.01517.86
7.4.130.0080.01216.88
7.4.120.0130.00716.71
7.4.110.0110.01116.73
7.4.100.0080.01416.82
7.4.90.0070.01416.85
7.4.80.0070.01319.39
7.4.70.0090.01616.71
7.4.60.0180.00916.52
7.4.50.0120.00516.62
7.4.40.0160.01016.54
7.4.30.0140.01216.59
7.4.20.0170.01416.23
7.4.10.0120.01315.84
7.4.00.0060.01515.83
7.3.330.0030.00313.43
7.3.320.0030.00313.27
7.3.310.0060.00316.52
7.3.300.0000.00916.55
7.3.290.0060.01316.69
7.3.280.0090.01116.67
7.3.270.0150.00617.40
7.3.260.0090.01216.77
7.3.250.0080.01316.92
7.3.240.0080.01316.62
7.3.230.0130.01016.80
7.3.210.0040.01516.76
7.3.200.0060.01416.73
7.3.190.0140.01216.62
7.3.180.0090.01716.48
7.3.170.0120.01216.67
7.3.160.0170.00916.68
7.3.150.0170.00916.34
7.3.140.0170.00816.34
7.3.130.0120.01015.70
7.3.120.0090.01115.61
7.3.110.0150.00815.93
7.3.100.0120.01015.87
7.3.90.0090.01615.88
7.3.80.0120.00515.85
7.3.70.0130.00915.85
7.3.60.0180.00715.80
7.3.50.0090.01815.87
7.3.40.0120.00815.56
7.3.30.0120.01015.87
7.3.20.0100.01116.71
7.3.10.0130.00916.69
7.3.00.0080.01516.86
7.2.330.0100.01016.99
7.2.320.0120.00916.65
7.2.310.0120.01116.73
7.2.300.0090.01416.71
7.2.290.0130.01016.88
7.2.280.0100.03916.62
7.2.270.0280.00016.47
7.2.260.0120.01415.79
7.2.250.0080.01515.95
7.2.240.0120.01016.13
7.2.230.0120.01015.86
7.2.220.0080.01515.83
7.2.210.0140.00715.88
7.2.200.0100.01315.86
7.2.190.0160.01115.87
7.2.180.0110.01315.90
7.2.170.0080.01215.87
7.2.160.0130.01316.07
7.2.150.0100.01216.89
7.2.140.0100.01316.97
7.2.130.0080.01316.94
7.2.120.0110.01316.93
7.2.110.0140.01116.88
7.2.100.0110.01016.89
7.2.90.0120.01016.94
7.2.80.0110.01516.76
7.2.70.0100.01516.62
7.2.60.0090.01216.95
7.2.50.0070.01317.07
7.2.40.0080.01516.82
7.2.30.0060.01516.92
7.2.20.0230.01416.94
7.2.10.0580.01017.00
7.2.00.0070.01417.74
7.1.330.0310.01415.84
7.1.320.0090.01115.93
7.1.310.0100.01015.89
7.1.300.0170.01515.85
7.1.290.0090.00915.97
7.1.280.0130.01415.77
7.1.270.0080.01115.70
7.1.260.0090.01315.64
7.1.250.0080.01315.69
7.1.240.0110.01315.63
7.1.230.0110.01415.74
7.1.220.0170.00815.66
7.1.210.0050.01715.59
7.1.200.0080.01115.80
7.1.190.0100.01315.82
7.1.180.0120.01015.88
7.1.170.0110.00915.82
7.1.160.0140.01415.73
7.1.150.0030.01515.91
7.1.140.0110.00915.89
7.1.130.0130.00615.78
7.1.120.0130.01115.70
7.1.110.0120.00815.71
7.1.100.0080.00815.77
7.1.90.0130.00615.68
7.1.80.0080.00915.88
7.1.70.0100.00816.39
7.1.60.0090.01417.02
7.1.50.0100.01816.21
7.1.40.0080.01215.89
7.1.30.0050.01415.65
7.1.20.0080.01415.71
7.1.10.0080.01415.84
7.1.00.0060.03218.02
7.0.330.0080.01515.37
7.0.320.0090.01215.41
7.0.310.0120.00815.46
7.0.300.0070.01215.25
7.0.290.0090.01415.30
7.0.280.0100.00815.48
7.0.270.0110.01015.42
7.0.260.0050.01315.56
7.0.250.0220.01215.44
7.0.240.0090.00915.60
7.0.230.0100.01015.51
7.0.220.0100.01015.65
7.0.210.0080.01015.43
7.0.200.0060.01115.95
7.0.190.0050.01315.40
7.0.180.0130.00815.58
7.0.170.0130.01415.57
7.0.160.0120.00815.42
7.0.150.0080.01015.43
7.0.140.0090.03317.79
7.0.130.0090.01515.50
7.0.120.0120.01115.62
7.0.110.0150.00715.55
7.0.100.0060.01115.54
7.0.90.0070.01115.53
7.0.80.0160.00615.49
7.0.70.0090.01615.60
7.0.60.0190.03417.04
7.0.50.0090.01916.26
7.0.40.0150.02316.54
7.0.30.0190.03416.35
7.0.20.0200.02216.50
7.0.10.0140.02616.40
7.0.00.0090.02816.50
5.6.400.0130.01415.31
5.6.390.0090.01215.14
5.6.380.0100.01215.07
5.6.370.0100.01215.03
5.6.360.0090.01015.50
5.6.350.0070.01215.23
5.6.340.0090.01115.23
5.6.330.0120.00815.26
5.6.320.0090.00915.53
5.6.310.0070.01715.36
5.6.300.0050.01715.38
5.6.290.0110.00815.53
5.6.280.0100.03217.14
5.6.270.0110.01315.30
5.6.260.0110.01015.27
5.6.250.0110.00815.13
5.6.240.0110.00815.27
5.6.230.0060.01315.22
5.6.220.0080.01215.13
5.6.210.0170.03117.26
5.6.200.0120.02716.38
5.6.190.0100.04017.17
5.6.180.0280.03617.18
5.6.170.0230.03417.15
5.6.160.0140.03917.18
5.6.150.0100.03716.30
5.6.140.0130.03216.38
5.6.130.0120.03516.28
5.6.120.0150.02317.26
5.6.110.0090.04317.35
5.6.100.0090.03717.22
5.6.90.0060.02217.13
5.6.80.0070.03217.14
5.6.70.0110.01115.14
5.6.60.0080.01415.15
5.6.50.0150.01015.38
5.6.40.0160.01315.31
5.6.30.0160.01415.30
5.6.20.0120.01715.50
5.6.10.0190.00815.35
5.6.00.0180.01015.24
5.5.380.0080.01215.07
5.5.370.0150.01015.17
5.5.360.0080.01515.06
5.5.350.0050.03816.82
5.5.340.0090.03416.18
5.5.330.0150.02016.88
5.5.320.0170.03116.94
5.5.310.0200.03517.00
5.5.300.0130.03416.32
5.5.290.0090.03016.42
5.5.280.0130.03617.13
5.5.270.0080.03717.11
5.5.260.0090.04217.28
5.5.250.0150.01917.05
5.5.240.0130.03016.95
5.5.230.0170.01215.36
5.5.220.0110.01515.13
5.5.210.0060.01715.11
5.5.200.0100.01615.12
5.5.190.0130.01515.25
5.5.180.0120.01615.32
5.5.170.0100.01714.84
5.5.160.0090.01515.16
5.5.150.0120.01515.07
5.5.140.0130.01215.02
5.5.130.0110.01214.97
5.5.120.0120.01015.15
5.5.110.0090.01515.21
5.5.100.0090.01314.95
5.5.90.0120.01415.19
5.5.80.0130.01015.23
5.5.70.0060.01915.17
5.5.60.0070.01615.26
5.5.50.0120.01015.13
5.5.40.0060.01915.28
5.5.30.0130.01015.03
5.5.20.0070.01515.07
5.5.10.0110.01415.04
5.5.00.0100.01515.11
5.4.450.0230.02214.32
5.4.440.0110.03214.45
5.4.430.0090.02214.65
5.4.420.0080.02614.41
5.4.410.0090.02514.33
5.4.400.0120.02314.25
5.4.390.0100.02514.24
5.4.380.0090.02314.08
5.4.370.0080.02214.16
5.4.360.0110.01813.97
5.4.350.0080.02312.07
5.4.340.0080.01911.97
5.4.330.0110.00411.66
5.4.320.0080.01912.07
5.4.310.0120.01811.98
5.4.300.0090.02112.07
5.4.290.0080.01812.19
5.4.280.0090.01912.00
5.4.270.0070.01812.01
5.4.260.0080.01612.00
5.4.250.0070.01912.04
5.4.240.0080.01712.02
5.4.230.0080.02211.92
5.4.220.0120.01612.10
5.4.210.0090.01512.15
5.4.200.0090.01712.07
5.4.190.0050.01911.91
5.4.180.0090.02312.10
5.4.170.0020.02511.90
5.4.160.0060.01912.01
5.4.150.0030.02412.04
5.4.140.0090.02011.99
5.4.130.0080.01811.81
5.4.120.0080.01811.81
5.4.110.0100.01511.88
5.4.100.0080.01811.81
5.4.90.0080.01611.92
5.4.80.0060.01912.03
5.4.70.0080.01712.03
5.4.60.0050.01912.04
5.4.50.0080.01611.89
5.4.40.0070.01912.00
5.4.30.0050.02011.85
5.4.20.0060.02012.03
5.4.10.0090.02111.98
5.4.00.0080.01811.89
5.3.290.0120.02112.30
5.3.280.0110.01712.20
5.3.270.0130.02112.41
5.3.260.0110.02212.37
5.3.250.0070.02412.44
5.3.240.0090.02412.25
5.3.230.0100.02512.38
5.3.220.0100.02212.36
5.3.210.0110.02412.31
5.3.200.0070.02512.35
5.3.190.0090.02312.27
5.3.180.0150.02512.47
5.3.170.0090.02212.39
5.3.160.0080.02012.32
5.3.150.0060.02112.43
5.3.140.0080.01812.39
5.3.130.0110.02212.33
5.3.120.0070.02212.34
5.3.110.0090.02212.29
5.3.100.0080.01812.29
5.3.90.0070.02312.19
5.3.80.0120.02012.07
5.3.70.0110.01811.99
5.3.60.0080.01912.04
5.3.50.0060.02312.13
5.3.40.0120.01712.11
5.3.30.0100.01912.13
5.3.20.0060.02112.04
5.3.10.0070.02311.89
5.3.00.0110.02211.92
5.2.170.0100.02310.56
5.2.160.0090.02210.56
5.2.150.0080.02110.56
5.2.140.0110.01810.57
5.2.130.0080.01810.54
5.2.120.0100.01610.54
5.2.110.0070.01910.54
5.2.100.0090.01810.54
5.2.90.0080.02210.61
5.2.80.0100.02110.54
5.2.70.0100.02210.54
5.2.60.0100.02210.52
5.2.50.0150.01610.50
5.2.40.0120.02110.49
5.2.30.0100.02110.48
5.2.20.0090.02110.47
5.2.10.0060.02410.43
5.2.00.0130.01810.36
5.1.60.0100.01710.00
5.1.50.0080.01910.00
5.1.40.0050.0199.99
5.1.30.0080.01910.16
5.1.20.0130.01410.17
5.1.10.0080.02010.04
5.1.00.0080.01810.04
5.0.50.0070.0129.27
5.0.40.0040.0169.21
5.0.30.0060.0229.11
5.0.20.0060.0129.09
5.0.10.0070.0119.08
5.0.00.0090.0169.08
4.4.90.0050.0168.34
4.4.80.0060.0108.33
4.4.70.0040.0148.33
4.4.60.0050.0118.33
4.4.50.0050.0118.33
4.4.40.0060.0158.30
4.4.30.0050.0098.33
4.4.20.0050.0138.37
4.4.10.0050.0118.38
4.4.00.0030.0158.33
4.3.110.0020.0128.29
4.3.100.0060.0098.29
4.3.90.0080.0128.27
4.3.80.0050.0168.24
4.3.70.0070.0098.27
4.3.60.0060.0128.27
4.3.50.0080.0108.27
4.3.40.0040.0178.22
4.3.30.0030.0127.60
4.3.20.0040.0147.59
4.3.10.0010.0127.57
4.3.00.0090.0099.52

preferences:
42.34 ms | 401 KiB | 5 Q