check if length is zero php code example Example: php string length $str = 'abcdef'; echo strlen($str); // 6