Quantcast
Channel: Milap Patel » String Functions
Viewing all articles
Browse latest Browse all 5

strlen() – Finding length of a PHP string

$
0
0

PHP strings can be of any length, since there is no limits to the size of strings in PHP. The PHP strings can be specified using either single quote (ex. ‘This is my test string’) or using double quotes (ex. “my test string”).PHP has some in built string manipulation functions.

The strlen PHP string function is used to find the length of the given string.

Example :

<?php

$string = ‘Milap’;
echo strlen($string);
?>

Output :
5

Another Example :

<?php
$string = ‘ Milap ‘;
echo strlen($string);
?>

Output:
7

Another One :

<?php
$string = ‘ Mi l a p ‘;
echo strlen($string);
?>

Output :
10

In php a "space" is countable as a part of the string & it is countable
in the lenght of the string.

Filed under: php, String Functions, strlen()

Viewing all articles
Browse latest Browse all 5

Trending Articles