Z
Z
Zhandos M2017-05-01 21:23:01
PHP
Zhandos M, 2017-05-01 21:23:01

String length with different letter case?

Hello!
Whether the length of a string with the same characters, but with a different letter case, will be the same.
Interested in the result of the strlen function.
As I understand it, Latin characters occupy one byte, any other non-Latin character is always two bytes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2017-05-01
@Zhandos

Case does not affect the number of characters or the number of bytes.
PS The number of bytes depends on the type of encoding (for example, Cyrillic in win-1251 - 1 byte, in utf-8 - 2 bytes). Counting bytes is rarely necessary. Usually count the number of characters - use mb_strlen.

R
Rsa97, 2017-05-01
@Rsa97

What character set are you working with?
Good article: https://habrahabr.ru/post/147387/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question