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>'; 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.00618.80
8.3.50.0100.01021.14
8.3.40.0070.01118.92
8.3.30.0120.00919.27
8.3.20.0090.00920.25
8.3.10.0090.00021.95
8.3.00.0000.00822.35
8.2.180.0170.00718.54
8.2.170.0090.00622.96
8.2.160.0030.01022.39
8.2.150.0190.00024.18
8.2.140.0050.00524.66
8.2.130.0000.01026.16
8.2.120.0030.00519.61
8.2.110.0070.01022.31
8.2.100.0110.00018.09
8.2.90.0040.00418.28
8.2.80.0050.00519.55
8.2.70.0050.00318.18
8.2.60.0000.00818.05
8.2.50.0050.00318.10
8.2.40.0000.00820.55
8.2.30.0030.00518.06
8.2.20.0000.00818.00
8.2.10.0050.00318.09
8.2.00.0060.00317.97
8.1.280.0070.01325.92
8.1.270.0060.00322.23
8.1.260.0000.00826.35
8.1.250.0030.01628.09
8.1.240.0040.00422.65
8.1.230.0090.00322.63
8.1.220.0080.00017.79
8.1.210.0040.00418.97
8.1.200.0040.00417.61
8.1.190.0040.00417.60
8.1.180.0090.00018.10
8.1.170.0030.00618.84
8.1.160.0040.00422.11
8.1.150.0030.00718.89
8.1.140.0040.00417.74
8.1.130.0050.00217.98
8.1.120.0070.00017.63
8.1.110.0040.00417.74
8.1.100.0020.00517.80
8.1.90.0050.00317.64
8.1.80.0000.00717.72
8.1.70.0040.00417.62
8.1.60.0040.00417.84
8.1.50.0040.00417.72
8.1.40.0060.00317.86
8.1.30.0050.00317.96
8.1.20.0000.00817.93
8.1.10.0030.00617.88
8.1.00.0000.00817.67
8.0.300.0000.00820.20
8.0.290.0040.00416.86
8.0.280.0000.00718.61
8.0.270.0050.00217.45
8.0.260.0070.00017.09
8.0.250.0080.00017.18
8.0.240.0000.00717.30
8.0.230.0040.00417.19
8.0.220.0030.00317.21
8.0.210.0030.00317.20
8.0.200.0030.00317.16
8.0.190.0000.00717.29
8.0.180.0000.00817.17
8.0.170.0050.00217.13
8.0.160.0000.00917.10
8.0.150.0000.00717.14
8.0.140.0000.00717.02
8.0.130.0030.00313.47
8.0.120.0030.00717.31
8.0.110.0000.01017.29
8.0.100.0030.00617.39
8.0.90.0070.00317.29
8.0.80.0120.00617.36
8.0.70.0030.00717.28
8.0.60.0060.00317.28
8.0.50.0090.00017.20
8.0.30.0070.01517.47
8.0.20.0050.01717.61
8.0.10.0030.00617.29
8.0.00.0080.01717.08
7.4.330.0000.00515.00
7.4.320.0060.00016.73
7.4.300.0000.00616.86
7.4.290.0070.00016.87
7.4.280.0000.00716.78
7.4.270.0040.00416.88
7.4.260.0050.00316.84
7.4.250.0040.00716.95
7.4.240.0030.00617.12
7.4.230.0000.00917.06
7.4.220.0130.01017.10
7.4.210.0100.01216.99
7.4.200.0000.00916.86
7.4.190.0000.01017.15
7.4.160.0100.01016.89
7.4.150.0110.01217.40
7.4.140.0080.01317.86
7.4.130.0080.01616.80
7.4.120.0070.01917.11
7.4.110.0110.01116.91
7.4.100.0060.01917.02
7.4.90.0160.00717.07
7.4.80.0070.01419.39
7.4.70.0170.01016.76
7.4.60.0110.01716.70
7.4.50.0100.00916.96
7.4.40.0150.01119.69
7.4.30.0150.01316.63
7.4.20.0140.01416.66
7.4.10.0130.01316.22
7.4.00.0090.01115.99
7.3.330.0030.00313.39
7.3.320.0030.00313.28
7.3.310.0060.00316.89
7.3.300.0060.00316.81
7.3.290.0080.01016.85
7.3.280.0090.01516.85
7.3.270.0070.01417.40
7.3.260.0140.01316.79
7.3.250.0120.00916.84
7.3.240.0110.01117.04
7.3.230.0120.01516.94
7.3.210.0110.00916.86
7.3.200.0110.00717.12
7.3.190.0100.01416.92
7.3.180.0130.01116.94
7.3.170.0140.01116.87
7.3.160.0190.01016.85
7.3.150.0240.01116.60
7.3.140.0200.01216.88
7.3.130.0080.01816.09
7.3.120.0100.01415.73
7.3.110.0110.01316.00
7.3.100.0070.01415.94
7.3.90.0130.00916.08
7.3.80.0130.01016.13
7.3.70.0140.01016.05
7.3.60.0120.00915.90
7.3.50.0100.01315.94
7.3.40.0010.02016.05
7.3.30.0110.01016.04
7.3.20.0080.01416.96
7.3.10.0110.01217.05
7.3.00.0080.01017.08
7.2.330.0070.02217.14
7.2.320.0110.01117.06
7.2.310.0160.01616.91
7.2.300.0070.01917.00
7.2.290.0110.01816.90
7.2.280.0200.01117.05
7.2.270.0210.01717.04
7.2.260.0110.01216.04
7.2.250.0080.01516.29
7.2.240.0090.01515.98
7.2.230.0050.01916.22
7.2.220.0090.01516.22
7.2.210.0160.01016.02
7.2.200.0080.01616.13
7.2.190.0070.01716.21
7.2.180.0090.01316.24
7.2.170.0060.01316.25
7.2.160.0130.01316.15
7.2.150.0260.01217.21
7.2.140.0070.01517.12
7.2.130.0130.00617.09
7.2.120.0100.01017.17
7.2.110.0090.01117.22
7.2.100.0160.00517.16
7.2.90.0080.01517.19
7.2.80.0080.01617.14
7.2.70.0050.01617.23
7.2.60.0080.01117.31
7.2.50.0060.01917.16
7.2.40.0030.01617.24
7.2.30.0050.01417.12
7.2.20.0070.01417.16
7.2.10.0070.01617.21
7.2.00.0160.00817.93
7.1.330.0210.00616.03
7.1.320.0080.01616.25
7.1.310.0200.00716.16
7.1.300.0150.01516.13
7.1.290.0160.01016.00
7.1.280.0150.01216.14
7.1.270.0120.01015.89
7.1.260.0130.01316.07
7.1.250.0160.01216.12
7.1.240.0280.01616.12
7.1.230.0130.01516.24
7.1.220.0130.00916.13
7.1.210.0130.01116.02
7.1.200.0190.01216.06
7.1.190.0260.00816.07
7.1.180.0130.01116.11
7.1.170.0130.01316.18
7.1.160.0080.01716.05
7.1.150.0210.00516.04
7.1.140.0200.00916.12
7.1.130.0080.01616.15
7.1.120.0190.00816.03
7.1.110.0100.01316.09
7.1.100.0130.00916.95
7.1.90.0160.00716.15
7.1.80.0160.00916.20
7.1.70.0090.01516.75
7.1.60.0110.01016.68
7.1.50.0110.01516.63
7.1.40.0150.01016.25
7.1.30.0100.01416.07
7.1.20.0140.01216.12
7.1.10.0100.01516.13
7.1.00.0110.03318.33
7.0.330.0160.01315.54
7.0.320.0130.01015.58
7.0.310.0180.00915.77
7.0.300.0120.01115.64
7.0.290.0130.01015.85
7.0.280.0160.01215.74
7.0.270.0130.01215.78
7.0.260.0180.00915.89
7.0.250.0230.00015.78
7.0.240.0050.01715.75
7.0.230.0110.01415.63
7.0.220.0120.01115.78
7.0.210.0200.00815.85
7.0.200.0680.00915.53
7.0.190.0120.01515.72
7.0.180.0180.00515.82
7.0.170.0180.00515.66
7.0.160.0090.01615.80
7.0.150.0130.00915.70
7.0.140.0080.03317.85
7.0.130.0180.01015.77
7.0.120.0130.01315.72
7.0.110.0110.03117.90
7.0.100.0120.02917.73
7.0.90.0210.03617.73
7.0.80.0070.03517.72
7.0.70.0120.02817.49
7.0.60.0050.03617.70
7.0.50.0070.03517.69
7.0.40.0130.03116.40
7.0.30.0060.03816.43
7.0.20.0100.03316.39
7.0.10.0090.03716.42
7.0.00.0110.03316.33
5.6.400.0110.01115.56
5.6.390.0090.02015.24
5.6.380.0160.00915.29
5.6.370.0130.01515.71
5.6.360.0130.01315.38
5.6.350.0070.02115.59
5.6.340.0100.01415.38
5.6.330.0090.01215.57
5.6.320.0140.01115.34
5.6.310.0140.01215.12
5.6.300.0110.01315.56
5.6.290.0100.01115.34
5.6.280.0130.03117.27
5.6.270.0100.01315.50
5.6.260.0060.03717.15
5.6.250.0110.01917.15
5.6.240.0070.03517.15
5.6.230.0060.03617.21
5.6.220.0050.03617.12
5.6.210.0060.03817.13
5.6.200.0090.03317.31
5.6.190.0100.03017.12
5.6.180.0080.03617.10
5.6.170.0080.03417.13
5.6.160.0090.03317.16
5.6.150.0080.03417.12
5.6.140.0070.03417.33
5.6.130.0090.02417.08
5.6.120.0180.04117.13
5.6.110.0110.03217.22
5.6.100.0060.03517.05
5.6.90.0150.03517.18
5.6.80.0080.02216.95
5.6.70.0090.02917.04
5.6.60.0070.02916.94
5.6.50.0090.02516.97
5.6.40.0120.03416.96
5.6.30.0100.03316.91
5.6.20.0100.02416.85
5.6.10.0150.02816.91
5.6.00.0080.03516.83
5.5.380.0110.03316.11
5.5.370.0140.03416.06
5.5.360.0090.03816.17
5.5.350.0090.03416.10
5.5.340.0090.04116.26
5.5.330.0120.03716.34
5.5.320.0120.03316.25
5.5.310.0160.03116.29
5.5.300.0120.03216.24
5.5.290.0060.03416.22
5.5.280.0070.04016.21
5.5.270.0130.03616.42
5.5.260.0140.03416.42
5.5.250.0180.03116.20
5.5.240.0070.03916.15
5.5.230.0080.03516.02
5.5.220.0110.02416.02
5.5.210.0110.03416.02
5.5.200.0080.03316.08
5.5.190.0110.03516.14
5.5.180.0190.03016.17
5.5.170.0130.01415.31
5.5.160.0140.02915.97
5.5.150.0110.02916.21
5.5.140.0120.03316.05
5.5.130.0100.03415.90
5.5.120.0080.03816.00
5.5.110.0080.03815.89
5.5.100.0130.03616.12
5.5.90.0060.03715.90
5.5.80.0150.03415.89
5.5.70.0120.02216.16
5.5.60.0110.03415.91
5.5.50.0110.03015.90
5.5.40.0150.03416.04
5.5.30.0070.03816.04
5.5.20.0120.02415.86
5.5.10.0090.02916.00
5.5.00.0130.03415.95
5.4.450.0070.03315.03
5.4.440.0090.02814.99
5.4.430.0120.02914.97
5.4.420.0120.03014.94
5.4.410.0080.03214.93
5.4.400.0110.02814.93
5.4.390.0100.03714.93
5.4.380.0070.02614.86
5.4.370.0050.03214.75
5.4.360.0090.03314.80
5.4.350.0090.02914.90
5.4.340.0050.03514.93
5.4.330.0130.00712.67
5.4.320.0080.03314.91
5.4.310.0080.02514.84
5.4.300.0060.03314.74
5.4.290.0120.02814.79
5.4.280.0040.03514.96
5.4.270.0140.02414.86
5.4.260.0080.03014.82
5.4.250.0080.03214.77
5.4.240.0100.02714.93
5.4.230.0100.03114.77
5.4.220.0090.03014.81
5.4.210.0100.02514.87
5.4.200.0050.03514.92
5.4.190.0110.02714.90
5.4.180.0060.03514.77
5.4.170.0090.02214.79
5.4.160.0090.03014.73
5.4.150.0110.03314.87
5.4.140.0050.03113.92
5.4.130.0090.02813.95
5.4.120.0090.02814.10
5.4.110.0100.02713.97
5.4.100.0120.01714.09
5.4.90.0080.03113.98
5.4.80.0100.02813.93
5.4.70.0110.02613.99
5.4.60.0110.02914.05
5.4.50.0100.03214.04
5.4.40.0070.03113.95
5.4.30.0070.02713.99
5.4.20.0060.02813.96
5.4.10.0080.02813.95
5.4.00.0100.02313.73
5.3.290.0080.03513.64
5.3.280.0100.03113.53
5.3.270.0100.03213.70
5.3.260.0090.03113.60
5.3.250.0060.03613.59
5.3.240.0070.03413.58
5.3.230.0060.03313.58
5.3.220.0080.03313.58
5.3.210.0080.03513.64
5.3.200.0100.03413.57
5.3.190.0100.03413.66
5.3.180.0120.03213.59
5.3.170.0070.03013.67
5.3.160.0040.03713.63
5.3.150.0130.02313.58
5.3.140.0100.03113.61
5.3.130.0090.01913.54
5.3.120.0120.02613.59
5.3.110.0110.02713.62
5.3.100.0050.03513.55
5.3.90.0100.03013.58
5.3.80.0100.02913.47
5.3.70.0090.03113.49
5.3.60.0080.03213.57
5.3.50.0060.02513.47
5.3.40.0090.03013.48
5.3.30.0090.02013.51
5.3.20.0080.03013.49
5.3.10.0090.02913.46
5.3.00.0080.03513.45
5.2.170.0100.03413.28
5.2.160.0090.02513.28
5.2.150.0070.03313.27
5.2.140.0100.03113.27
5.2.130.0080.03213.33
5.2.120.0060.03113.28
5.2.110.0090.03013.27
5.2.100.0070.03413.27
5.2.90.0170.03313.27
5.2.80.0090.03413.27
5.2.70.0040.03813.27
5.2.60.0120.03213.27
5.2.50.0110.03513.27
5.2.40.0110.03613.27
5.2.30.0080.03013.27
5.2.20.0150.03113.27
5.2.10.0050.02913.27
5.2.00.0110.03213.27
5.1.60.0070.03113.27
5.1.50.0070.02913.27
5.1.40.0040.03213.27
5.1.30.0080.03113.27
5.1.20.0050.03613.27
5.1.10.0070.03113.27
5.1.00.0050.03213.27
5.0.50.0060.02613.27
5.0.40.0060.02313.27
5.0.30.0090.03213.27
5.0.20.0060.02313.27
5.0.10.0030.02513.27
5.0.00.0130.03013.27
4.4.90.0010.02113.27
4.4.80.0030.01013.27
4.4.70.0070.01713.27
4.4.60.0060.01613.27
4.4.50.0020.01913.27
4.4.40.0040.03013.27
4.4.30.0050.01613.27
4.4.20.0040.02013.27
4.4.10.0060.01813.27
4.4.00.0040.01613.27
4.3.110.0060.01713.27
4.3.100.0040.01813.27
4.3.90.0030.02013.27
4.3.80.0060.02613.27
4.3.70.0060.01813.27
4.3.60.0050.01813.27
4.3.50.0060.01813.27
4.3.40.0070.02513.27
4.3.30.0060.01713.27
4.3.20.0000.02213.27
4.3.10.0030.02013.27
4.3.00.0060.01413.27

preferences:
68.63 ms | 401 KiB | 5 Q