All Functions

trim - remove whitespace

The trim function removes whitespace characters from the start or the end of a string (also known as leading and trailing whitespace characters).

"Whitespace characters" are characters such as Spaces, Tabs, New Lines Source:


trim ( $string ) Returns a string without whitespace at the start or end


$string The string where whitespace needs to be removed from the start or end position


Removing (or trimming) whitespace from a string

trim( s t r i n g )
returns "s t r i n g"

trim( string )
returns "string"

See also

strip - remove all whitespace truncate - truncate string length