Logo

Programming-Idioms

History of Idiom 169 > diff from v43 to v44

Edit summary for version 44 by ricardo_sdl:
New PHP implementation by user [ricardo_sdl]

Version 43

2018-08-18, 20:04:29

Version 44

2018-08-22, 17:20:23

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.

Illustration

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.

Illustration
Extra Keywords
size
Extra Keywords
size
Code
$n = strlen($s);
Comments bubble
returns the number of bytes (good for ascii strings as 1 byte = 1 character)
Doc URL
https://secure.php.net/manual/en/function.strlen.php
Demo URL
https://3v4l.org/vB4JM