PHP

 Home  Computers & Internet  Web Programming PHP
What is PHP?
Echo
Comments
Variables
Constants
Data Types
number_format()
Character Strings
Mathematical Operators
Comparison Operators
Logical Operators
Joining Strings
explode()
implode()
strtolower()
strtoupper()
strlen()
ucfirst()
ucwords()
strrev()
str_replace()
str_repeat()
trim()
strip_tags()
addslashes()
stripslashes()
strpos()
strrpos()
nl2br()
isset()
unset()
empty()
POST
GET
If Statements
If Else Statements
Elseif Statements
Switch Statements
For Loops
While Loops
Do While Loops
Foreach Loops
File Create
File Open
File Read
File Write
File Delete
fgets()
file_get_contents()
Date & Time
$_SERVER
Sessions
Cookies
Arrays

HOW TO USE THE strlen() FUNCTION IN PHP

The strlen() function gives you a count of the number of characters in a string.

Example 1:

$string="Vacation";
$noOfChars=strlen($string);

echo $noOfChars;

The above will output: 8

Example 2:

$string="My Name Is John Smith";
$noOfChars=strlen($string);

echo $noOfChars;

The above will output: 21. Note that a single whitespace is also considered a character.

Home | Privacy Policy | Terms Of Use | Contact Us