trim() function removes all whitespace from both sides of string : trim « String « PHP






trim() function removes all whitespace from both sides of string

 
Its syntax is: string trim (string string)

It will also remove the special characters "\n", "\r", "\t", "\v" and "\0".

<?

print ">".trim(" asdf ")."<";

?>
  
  








Related examples in the same category

1.Checking the length of a trimmed string
2.Combining trim() and strlen()
3.string trim ( string str [, string trim_chars] ) strips spaces, new lines, and tabs