3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '東舘町'; var_dump(mb_detect_encoding($str, ['UTF-8','SJIS-WIN'], true)); var_dump(mb_detect_encoding($str, ['UTF-8','SJIS-WIN'], false)); var_dump(mb_detect_encoding_php80($str, ['UTF-8','SJIS-WIN'])); function mb_detect_encoding_php80($string, $encodings) { foreach($encodings as $encoding) { $result = mb_detect_encoding($string, $encoding, true); if ($result !== false) { return $result; } } }

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.01117.68
8.4.130.0080.00418.89
8.4.120.0110.00624.05
8.4.110.0060.00322.53
8.4.100.0120.00917.60
8.4.90.0090.00118.50
8.4.80.0130.00719.48
8.4.70.0130.00717.91
8.4.60.0120.00618.85
8.4.50.0100.00918.43
8.4.40.0060.01317.42
8.4.30.0030.02020.39
8.4.20.0150.00318.84
8.4.10.0080.00019.59
8.3.270.0110.00916.46
8.3.260.0050.00316.54
8.3.250.0110.00818.63
8.3.240.0110.00618.71
8.3.230.0130.00716.70
8.3.220.0130.00517.30
8.3.210.0100.01016.59
8.3.200.0050.00416.64
8.3.190.0050.00319.12
8.3.180.0100.00916.55
8.3.170.0120.00618.75
8.3.160.0150.00318.28
8.3.150.0120.00620.83
8.3.140.0150.00417.30
8.3.130.0160.00318.41
8.3.120.0030.00620.86
8.3.110.0100.01020.94
8.3.100.0040.00424.06
8.3.90.0060.01226.77
8.3.80.0030.00617.97
8.3.70.0170.00018.18
8.3.60.0120.00316.32
8.3.50.0110.00716.79
8.3.40.0030.01020.29
8.3.30.0030.01021.91
8.3.20.0000.00824.18
8.3.10.0050.00224.66
8.3.00.0050.00326.16
8.2.290.0110.00620.26
8.2.280.0100.00818.34
8.2.270.0080.00017.38
8.2.260.0070.01019.97
8.2.250.0050.00316.66
8.2.240.0040.00417.34
8.2.230.0060.00322.58
8.2.220.0070.01337.54
8.2.210.0040.00426.77
8.2.200.0060.00316.50
8.2.190.0090.00616.63
8.2.180.0180.00416.50
8.2.170.0150.00319.04
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00020.59
8.2.110.0130.01020.59
8.2.100.0070.01719.28
8.2.90.0240.01018.87
8.2.80.0110.01918.84
8.2.70.0270.00918.98
8.2.60.0180.01118.84
8.2.50.0300.00718.69
8.2.40.0280.00618.89
8.2.30.0120.00018.92
8.2.20.0260.00318.82
8.2.10.0210.00719.39
8.2.00.0280.01419.16
8.1.330.0100.00921.93
8.1.320.0110.00818.62
8.1.310.0110.00718.36
8.1.300.0060.00318.04
8.1.290.0060.00330.84
8.1.280.0110.00825.92
8.1.270.0100.01023.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0180.00418.47
8.1.230.0190.00318.46
8.1.220.0120.00618.66
8.1.210.0250.01320.05
8.1.200.0240.00718.50
8.1.190.0240.00618.39
8.1.180.0270.00918.62
8.1.170.0170.00718.58
8.1.160.0200.00018.98
8.1.150.0270.00320.50
8.1.140.0270.00318.81
8.1.130.0130.00518.77
8.1.120.0130.00318.93
8.1.110.0090.00618.75
8.1.100.0120.00418.97
8.1.90.0040.01318.64
8.1.80.0160.00018.80
8.1.70.0180.00018.76
8.1.60.0240.00018.86
8.1.50.0190.01018.74
8.1.40.0180.00618.94
8.1.30.0250.00319.10
8.1.20.0140.00418.98
8.1.10.0050.01018.77
8.1.00.0170.00318.73
8.0.300.0190.00317.90
8.0.290.0200.00717.90
8.0.280.0210.00317.88
8.0.270.0110.00817.91
8.0.260.0280.00917.95
8.0.250.0310.00317.83
8.0.240.0260.01118.04
8.0.230.0260.00718.23
8.0.220.0110.00318.06
8.0.210.0200.00317.89
8.0.200.0160.00318.04
8.0.190.0180.01118.00
8.0.180.0230.01617.71
8.0.170.0170.01418.07
8.0.160.0130.00917.93
8.0.150.0340.00317.83
8.0.140.0320.00717.99
8.0.130.0290.00318.16
8.0.120.0320.00617.90
8.0.110.0340.00317.78
8.0.100.0110.00617.94
8.0.90.0200.00018.00
8.0.80.0100.00717.95
8.0.70.0120.00417.88
8.0.60.0180.00017.91
8.0.50.0180.00017.89
8.0.30.0080.00818.07
8.0.20.0100.00818.08
8.0.10.0220.00417.94

preferences:
36.22 ms | 403 KiB | 5 Q