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…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
strlenis one of the naïve PHP core functions that understand strings as byte arrays and assume one byte == one character. Usemb_strlenwith the correct encoding parameter to actually count characters according to the encoding of your string.