1
2<?php
3$str = 'abcdef';
4echo strlen($str); // 6
5
6$str = ' ab cd ';
7echo strlen($str); // 7
8?>
9
10
1<?php
2$name = 'abcdef';
3echo strlen($str); // 6
4
5$string = ' ab cd ';
6echo strlen($str); // 7
7?>
1<?php
2$str = 'abcdef';
3echo strlen($str); // 6
4
5$str = ' ab cd ';
6echo strlen($str); // 7
7?>
1<?php
2$str = 'php';
3echo strlen($str); // 3
4
5$str = 's p a c e';
6echo strlen($str); // 9
7?>
1/*
2To measure the length of string there is built-in function in php which returns the exact length of string.
3*/
4
5Syntax:
6strlen(paramenter);
7
8<?php
9$name = 'ankur';
10echo "Name Length : ".strlen($name); // Name Length : 5
11
12$message = 'Welcome greppers !';
13echo "Message Length : ".strlen($message); // Message Length : 18
14?>
15
16/*
17I hope it will help you.
18Namaste
19*/