Welcome to PHPMule.com
A blog site which I am posting to during my learning of the popular programming language PHP. Feel free to leave comments!
-
PHP - Trimming Strings
The trimming string functions:
In a string you can have excess whitespace you don’t need but is very useful if you want to store this string in a file or database.
The trim() function will remove any whitespace from the beginning or end of string for example if you had the string “ celebrity ” the resulting string will be “celebrity” as all the whitespace is removed from the start and end.
There are two other trimming functions and these are:
ltrim() and rtrim()
These functions do the same thing as the ‘trim()’ function but instead the first one removes whitespace from the left hand side and the other one removes whitespace from the right hand side.
The main purpose of trimming is to have cleaner input from your visitors, for example if they were to accidently include a space before they input their name on a form.
(Post created on Monday, April 13th 09 at 16:30)
-
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||
Archives
Recent Articles
- PHP - Rounding Off Numbers
- PHP - Single vs Double Quotation Marks
- PHP - Loading Files Into Your PHP Script By Using require() and include()
- PHP - Replacing Strings With Other Strings
- PHP - Finding Strings Within Strings
- PHP - Using strlen() To Test String Length
- PHP - Using The explode() Function
- PHP - Changing The String Case
- PHP - The nl2br() Function
- PHP - Trimming Strings
Links
Categories
- PHP (22)
- Uncategorized (1)


