1
2<?php
3$str = 'abcdef';
4echo strlen($str); // 6
5
6$str = ' ab cd ';
7echo strlen($str); // 7
8?>
9
10
1// using count() we can get proper length of the array
2$names = array("Ankur","Raj","Ram","Suresh");
3// pass array into count() as parameter it will return array length
4echo count($names);
5
6// output : 4
1// https://www.php.net/manual/en/function.count.php
2$a = array(1,3,5);
3echo count($a);
4// -> 3