Combining trim() and strlen() : trim « String « PHP






Combining trim() and strlen()

 
if (strlen(trim($_POST['name'])) == 0) {
    $errors[] = "Your name is required.";
}
  
  








Related examples in the same category

1.Checking the length of a trimmed string
2.string trim ( string str [, string trim_chars] ) strips spaces, new lines, and tabs
3.trim() function removes all whitespace from both sides of string