<?php $name = 'abcdef'; echo strlen($str); // 6 $string = ' ab cd '; echo strlen($str); // 7 ?>
Use the PHP strlen() function