php man page for strlen

Query: strlen

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

STRLEN(3)								 1								 STRLEN(3)

strlen - Get string length

SYNOPSIS
int strlen (string $string)
DESCRIPTION
Returns the length of the given $string.
PARAMETERS
o $string - The string being measured for length.
RETURN VALUES
The length of the $string on success, and 0 if the $string is empty.
CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Prior versions treated arrays as the string | | | Array, thus returning a string length of 5 and | | | emitting an E_NOTICE level error. | | | | +--------+---------------------------------------------------+
EXAMPLES
Example #1 A strlen(3) example <?php $str = 'abcdef'; echo strlen($str); // 6 $str = ' ab cd '; echo strlen($str); // 7 ?>
NOTES
Note strlen(3) returns the number of bytes rather than the number of characters in a string. Note strlen(3) returns NULL when executed on arrays, and an E_WARNING level error is emitted.
SEE ALSO
count(3), grapheme_strlen(3), iconv_strlen(3), mb_strlen(3). PHP Documentation Group STRLEN(3)
Related Man Pages
strlen(3posix) - posix
strlen(3) - opendarwin
strlen(3) - xfree86
strlen(3) - x11r4
strlen(3) - v7
Similar Topics in the Unix Linux Community
How to free the memory?
length function
'strlen' of a constant string
Align number to same length by adding &quot;0&quot;
Need help to find total counts in a string