Logo

Programming-Idioms

History of Idiom 169 > diff from v34 to v35

Edit summary for version 35 by programming-idioms.org:
[PHP] strlen is not appropriate

Version 34

2018-04-06, 07:09:38

Version 35

2018-04-06, 20:06:49

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Extra Keywords
size
Extra Keywords
size
Code
$n = strlen($s);
Code
$n = strlen($s);
Comments bubble
strlen() returns the number of bytes rather than the number of characters in a string.
Doc URL
http://php.net/manual/en/function.strlen.php
Doc URL
http://php.net/manual/en/function.strlen.php