Home and Learn: PHP Programming Course

The PHP strlen() function


To get the length of a string in PHP use the strlen function. The length is how many characters are in the string:

$string_length = strlen( "This is some text" );

The above line of code returns a value of 17 - the number of character and spaces in the string.

<-- Back One Page | Move on to the Next Part -->

Back to the PHP Contents Page

Email us: enquiry at homeandlearn.co.uk