PHP strlen function

strlen

(PHP 3, PHP 4, PHP 5)

strlen -- Get string lengthDescriptionint strlen ( string string )

Returns the length of the given string.

Parameters

string

The string being measured for length.


Return Values

The length of the string on success,
and 0 if the string is empty.

Examples

Example 1. A strlen() example

PHP:
  1. $str = 'abcdef';
  2. echo strlen($str); // 6
  3.  
  4. $str = ' ab cd ';
  5. echo strlen($str); // 7

See Also

count()mb_strlen()


These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank
  • Technorati

Home | PHP Functions | PHP strlen function