php number of chars in string code example Example: php string length $str = 'abcdef'; echo strlen($str); // 6