PHP » GoLang |
login |
register |
about
|
trim(PHP 4, PHP 5, PHP 7) trim — Strip whitespace (or other characters) from the beginning and end of a string Description
string trim
( string
$str
[, string $character_mask = " \t\n\r\0\x0B"
] )
This function returns a string with whitespace stripped from the
beginning and end of
Parameters
Return ValuesThe trimmed string. Examples
Example #1 Usage example of trim()
<?php The above example will output: string(32) " These are a few words :) ... " string(16) " Example string " string(11) "Hello World" string(28) "These are a few words :) ..." string(24) "These are a few words :)" string(5) "o Wor" string(9) "ello Worl" string(14) "Example string"
Example #2 Trimming array values with trim()
<?php The above example will output: array(3) { [0]=> string(5) "apple" [1]=> string(7) "banana " [2]=> string(11) " cranberry " } array(3) { [0]=> string(5) "apple" [1]=> string(6) "banana" [2]=> string(9) "cranberry" } Notes
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|