Remove the white space then c sound the character.You can use the trim() function in php to remove white spaces before strlen()