How to convert a string to uppercase in PHP?

by wilmer.lemke , in category: PHP General , 2 years ago

How to convert a string to uppercase in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by darrion.kuhn , 2 years ago

@wilmer.lemke 

In PHP, you can convert a string to uppercase using the strtoupper() function. This function takes a string as its argument and returns a new string with all the characters in uppercase.


Here's an example:

1
2
3
$string = "Hello World!";
$uppercase_string = strtoupper($string);
echo $uppercase_string; // outputs "HELLO WORLD!"


In the example above, the strtoupper() function is used to convert the string "Hello World!" to "HELLO WORLD!". The resulting uppercase string is then printed using the echo statement.

Related Threads:

How to convert a string to lowercase in PHP?
How to convert a json string to an array in php?
How to strip invalid characters from a string in php?
How to convert array into string in Codeigniter?
How to convert array to string in codeigniter?
How to convert array to string in laravel?