Member-only story
PHP strtoupper() and strtolower() string functions
Manipulating text or string data is such a common task that most all programming languages provide built-in functions for this specific purpose. PHP is no different in that regard. The language comes chock-full of different string manipulating functions. If you need string data in all capitalized or upper-cased letters, you can use strtoupper()
. What about all lower-case strings? The strtolower()
function takes of that. In this post, we visit some rudimentary examples and gain a feel for how these 2 functions operate.
Self-Promotion:
If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!
Below are some example uses of strtoupper()
and strtolower()
. Experiment with them on your particular string data to know for sure how they behave…
Lower-case, single word
$first_name = ‘josh’;echo ‘strtoupper(): ‘.strtoupper($first_name);echo ‘strtolower(): ‘.strtolower($first_name);strtoupper(): JOSH
strtolower(): josh