⊗ppPmBsSL 30 of 447 menu

String Length in PHP

The number of characters in a string can be found using the function strlen:

<?php echo strlen('abcde'); // outputs 5 ?>

The string can also be stored in a variable:

<?php $str = 'abcde'; echo strlen($str); // outputs 5 ?>

A space is also a character:

<?php echo strlen('ab de'); // outputs 5 ?>

Write any string into a variable. Display the length of your string on the screen.

byenru