<?php
$item = mb_convert_encoding(
'¨l',
'ISO-8859-1',
'UTF-8'
);
$encoding = 'UTF-8';
$ret = '';
$max = mb_strlen($item ?? '', $encoding);
for ($i = 0; $i < $max; $i++) {
$char = mb_substr($item, $i, 1, $encoding);
$up = mb_strtoupper($char, $encoding);
$low = mb_strtolower($char, $encoding);
$ret .= ($up != $low) ? '[' . $up . $low . ']' : $char;
}
var_dump($ret);
- Output for 8.3.2 - 8.3.11
- string(5) "?[Ll]"
- Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.1
- string(5) "�[Ll]"
preferences:
43.59 ms | 407 KiB | 5 Q