PHP strlen Function



PHP Tutorial > String Functions > strlen Function

The strlen function in PHP is used to return the length of a string. The syntax of the strlen function is:

strlen ('string')

Let's take a look at the examples below:

Example 1

print strlen ('Strlen Function');

Result:

15

Example 2

print strlen (' Length ');

Result:

8

From the above, we see that spaces count towards string length just like a character does.

Next: PHP strpos Function

Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.




More 1Keydata Tutorials



PHP addslashes
PHP echo
PHP explode
PHP htmlentities
PHP htmlspecialchars
PHP implode
PHP md5
PHP number_format
PHP print
PHP str_replace
PHP strlen
PHP strpos
PHP strstr
PHP substr
PHP trim

PHP Syntax

PHP Sitemap

PHP Resources