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 - Changing The String Case
If you wanted to change the case of a string for example the word ‘television’ into ‘TELEVISION’ you can easily do so in PHP. You can do it vice versa as well.
Here are the following functions you can use to change the case of a string:
Let’s use the following functions with the variable ‘$television’ By the way the variable $television contains the value “what brand of tv do you own?”
strtoupper($television) = WHAT BRAND OF TV DO YOU OWN?
strrtolower($televison) = what brand of tv do you own?
ucfirst($television) = What brand of tv do you own?
ucwords($televison) = What Brand Of Tv Do You Own?
The first function converts the alphabetic characters to uppercase, the second to uppercase. The third function converts the first letter of the first word in uppercase and the fourth function converts the first letter of each word in uppercase.
These functions could be used in web forums and you would prefer your comments to start in uppercase. To be honest it really depends on how well you want to present your website I suppose.
(Post created on Monday, April 12th 09 at 19: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)


