TRIM
(PHP 3, PHP 4> = 4.0.0) Trim - Remove a blank of a string start and end
description
String Trim (String Str [String Charlist])
Note: The second parameter is used in PHP 4.1.0
This function returns a Str string to remove new strings after the first tail blank. Without the second parameter Trim () will remove the following characters:
"(ASCII 32 (0x20)), space;" / t "(ASCII 9 (0x09)), tab;" / n "(ASCII 10 (0x0a)), newline character;" / r "(ASCII 13 (0x0D)), the carriage return; "/ 0" (ASCII 0 (0x00)), empty characters; "/ X0b" (ASCII 11 (0x0b)), vertical tab.
You can specify the characters you want to remove through the Charlist parameter. Simply List All Characters That You Want To Be Stripped. With .. You can Specify A Range of Characters.
Example 1. Trim () example
PHP
$ text = "/ T / TThese Are A few Words :) ...";
$ TIMMED = Trim ($ TEX);
// $ TRIMMED = "There Are A Few Words :) ..."
$ TIMMED = TRIM ($ text, "/ t.");
// $ TRIMMED = "There Are A Few Words :)"
$ Clean = Trim ($ binary, "/ 0x00 ../ 0x1f");
// Trim The Ascii Control Characters At The Beginning and End of $ Binary
// (from 0 to 31 inclusive)
?>
See LTRIM () and RTRIM ().