3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tai = '鯛'; // A kind of fish, included in JIS X 0208 $kasago = '鮋'; // A kind of fish, included in JIS X 0212, not included in JIS X 0213. $hokke = '𩸽'; // A kind of fish, included in JIS X 0213, not included in JIS X 0212. echo "# mb_convert_encoding\n"; $tai_iso2022jp = mb_convert_encoding($tai, 'ISO-2022-JP', 'UTF-8'); $tai_jis = mb_convert_encoding($tai, 'JIS', 'UTF-8'); $tai_iso2022jp_2004 = mb_convert_encoding($tai, 'ISO-2022-JP-2004', 'UTF-8'); echo "Convert tai to ISO-2022-JP : " . bin2hex($tai_iso2022jp) . "\n"; echo "Convert tai to JIS : " . bin2hex($tai_jis) . "\n"; echo "Convert tai to ISO-2022-JP-2004 : " . bin2hex($tai_iso2022jp_2004) . "\n"; echo "\n"; $kasago_iso2022jp = mb_convert_encoding($kasago, 'ISO-2022-JP', 'UTF-8'); $kasago_jis = mb_convert_encoding($kasago, 'JIS', 'UTF-8'); $kasago_iso2022jp_2004 = mb_convert_encoding($kasago, 'ISO-2022-JP-2004', 'UTF-8'); echo "Convert kasago to ISO-2022-JP : " . bin2hex($kasago_iso2022jp) . "\n"; echo "Convert kasago to JIS : " . bin2hex($kasago_jis) . "\n"; echo "Convert kasago to ISO-2022-JP-2004: " . bin2hex($kasago_iso2022jp_2004) . "\n"; echo "\n"; $hokke_iso2022jp = mb_convert_encoding($hokke, 'ISO-2022-JP', 'UTF-8'); $hokke_jis = mb_convert_encoding($hokke, 'JIS', 'UTF-8'); $hokke_iso2022jp_2004 = mb_convert_encoding($hokke, 'ISO-2022-JP-2004', 'UTF-8'); echo "Convert hokke to ISO-2022-JP : " . bin2hex($hokke_iso2022jp) . "\n"; echo "Convert hokke to JIS : " . bin2hex($hokke_jis) . "\n"; echo "Convert hokke to ISO-2022-JP-2004 : " . bin2hex($hokke_iso2022jp_2004) . "\n"; echo "\n"; echo "# mb_check_encoding\n"; $tai_0208 = mb_convert_encoding($tai, 'ISO-2022-JP', 'UTF-8'); // 1b244242641b2842 $kasago_0212 = mb_convert_encoding($kasago, 'JIS', 'UTF-8'); // 1b2428446a591b2842 $hokke_0213 = mb_convert_encoding($hokke, 'ISO-2022-JP-2004', 'UTF-8'); // 1b2428507d4c1b2842 echo "Tai written in JIS X 0208 : " . bin2hex($tai_0208) . "\n"; echo "Hokke written in JIS X 0212 : " . bin2hex($kasago_0212) . "\n"; echo "Kasago written in JIS X 0213: " . bin2hex($hokke_0213) . "\n"; echo "\n"; echo "Tai written in JIS X 0208\n"; echo "ISO-2022-JP : "; var_dump(mb_check_encoding($tai_0208, 'iso-2022-jp')); // true is expected echo "JIS : "; var_dump(mb_check_encoding($tai_0208, 'jis')); // true is expected echo "ISO-2022-JP-2004: "; var_dump(mb_check_encoding($tai_0208, 'iso-2022-jp-2004')); // true is expected echo "\n"; echo "Kasago written in JIS X 0212\n"; echo "ISO-2022-JP : "; var_dump(mb_check_encoding($kasago_0212, 'iso-2022-jp')); // false is expected echo "JIS : "; var_dump(mb_check_encoding($kasago_0212, 'jis')); // true is expected echo "ISO-2022-JP-2004: "; var_dump(mb_check_encoding($kasago_0212, 'iso-2022-jp-2004')); // false is expected echo "\n"; echo "Hokke written in JIS X 0213\n"; echo "ISO-2022-JP : "; var_dump(mb_check_encoding($hokke_0213, 'iso-2022-jp')); // false is expected echo "JIS : "; var_dump(mb_check_encoding($hokke_0213, 'jis')); // false is expected echo "ISO-2022-JP-2004: "; var_dump(mb_check_encoding($hokke_0213, 'iso-2022-jp-2004')); // true is expected

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.4.140.0110.01218.06
8.4.130.0150.00518.71
8.4.120.0140.00723.90
8.4.110.0090.01119.21
8.4.100.0130.00817.81
8.4.90.0090.01118.91
8.4.80.0100.00818.89
8.4.70.0100.00618.96
8.4.60.0130.00518.86
8.4.50.0070.00418.82
8.4.40.0040.00720.85
8.4.30.0040.00421.01
8.4.20.0100.01020.08
8.4.10.0150.00023.67
8.3.260.0130.00716.74
8.3.250.0130.00719.17
8.3.240.0140.00517.52
8.3.230.0130.00616.97
8.3.220.0110.00819.27
8.3.210.0090.01018.68
8.3.200.0050.00316.97
8.3.190.0120.00717.34
8.3.180.0080.01120.97
8.3.170.0180.00018.52
8.3.160.0070.01117.38
8.3.150.0130.01016.98
8.3.140.0040.00420.93
8.3.130.0070.00318.36
8.3.120.0080.00018.97
8.3.110.0090.00020.94
8.3.100.0040.00424.06
8.3.90.0060.00326.77
8.3.80.0090.00018.81
8.3.70.0070.01118.43
8.3.60.0110.00516.74
8.3.50.0110.00716.89
8.3.40.0130.00320.34
8.3.30.0120.00318.82
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.290.0030.00720.67
8.2.280.0150.00418.67
8.2.270.0130.00616.83
8.2.260.0070.01116.92
8.2.250.0150.00016.95
8.2.240.0030.00618.91
8.2.230.0030.00622.58
8.2.220.0050.00337.54
8.2.210.0060.00326.77
8.2.200.0030.00717.13
8.2.190.0060.01216.70
8.2.180.0120.00917.00
8.2.170.0030.01319.21
8.2.160.0040.01122.96
8.2.150.0030.00625.66
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0030.00526.16
8.2.110.0060.00322.50
8.2.100.0100.00317.84
8.2.90.0060.00319.67
8.2.80.0060.00318.28
8.2.70.0080.00017.86
8.2.60.0080.00018.05
8.2.50.0040.00418.07
8.2.40.0200.00017.75
8.2.30.0070.01319.35
8.2.20.0120.00917.88
8.2.10.0140.00517.88
8.2.00.0160.00317.74
8.1.330.0110.00721.88
8.1.320.0150.00916.62
8.1.310.0140.00417.15
8.1.300.0170.00020.41
8.1.290.0060.00330.84
8.1.280.0140.00425.92
8.1.270.0090.00024.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00623.95
8.1.230.0060.00619.39
8.1.220.0060.00317.91
8.1.210.0050.00518.77
8.1.200.0000.00817.73
8.1.190.0060.00317.90
8.1.180.0040.00418.10
8.1.170.0040.00819.08
8.1.160.0090.00917.62
8.1.150.0130.00517.62
8.1.140.0130.01017.62
8.1.130.0180.00517.71
8.1.120.0180.00517.62
8.1.110.0180.00417.62
8.1.100.0150.00517.63
8.1.90.0100.01017.62
8.1.80.0110.00817.63
8.1.70.0140.00617.62
8.1.60.0100.01217.62
8.1.50.0130.00917.73
8.1.40.0200.00417.73
8.1.30.0180.00517.88
8.1.20.0160.00717.75
8.1.10.0160.00817.63
8.1.00.0090.01317.62
8.0.300.0070.00018.77
8.0.290.0050.00217.41
8.0.280.0090.00917.62
8.0.270.0150.00517.62
8.0.260.0090.00917.62
8.0.250.0140.00517.62
8.0.240.0200.00017.62
8.0.230.0120.00917.62
8.0.220.0200.00017.62
8.0.210.0070.01117.62
8.0.200.0000.01817.62
8.0.190.0140.00417.62
8.0.180.0140.00617.62
8.0.170.0160.00517.62
8.0.160.0100.01017.62
8.0.150.0030.01817.62
8.0.140.0190.00017.62
8.0.130.0120.00617.62
8.0.120.0180.00017.62
8.0.110.0160.00317.62
8.0.100.0140.00617.62
8.0.90.0120.00617.62
8.0.80.0160.00317.62
8.0.70.0190.00017.62
8.0.60.0140.00417.62
8.0.50.0160.00517.62
8.0.30.0110.00717.62
8.0.20.0140.01017.62
8.0.10.0080.01117.62

preferences:
35.21 ms | 403 KiB | 5 Q