- Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- string(5) "UCS-2" string(7) "UCS-2LE" string(7) "UCS-2LE" string(5) "UTF-8"
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30
- string(5) "UTF-8" string(5) "UTF-8" string(5) "UTF-8" string(5) "UTF-8"
<?php
$strings = ['bl', 'Bl', 'Blog', 'Blo'];
foreach ($strings as &$str) {
var_dump(mb_detect_encoding($str, mb_list_encodings()));
}