I've a simple code like so:
echo strlen('Grækenland');
and it's returning 11 instead of expected 10
The server is in denmark, locale was set to danish, but it still returns 11...
I've a simple code like so:
echo strlen('Grækenland');
and it's returning 11 instead of expected 10
The server is in denmark, locale was set to danish, but it still returns 11...
strlen
is one of the naïve PHP core functions that understand strings as byte arrays and assume one byte == one character. Use mb_strlen
with the correct encoding parameter to actually count characters according to the encoding of your string.