//string to all uppercase
$string = "String with Mixed use of Uppercase and Lowercase";
//php string to uppercase
$string = strtoupper($string);
// = "STRING WITH MIXED USE OF UPPERCASE AND LOWERCASE"
<?php
$foo = 'bonjour tout le monde!';
$foo = ucfirst($foo); // Bonjour tout le monde!
$bar = 'BONJOUR TOUT LE MONDE!';
$bar = ucfirst($bar); // BONJOUR TOUT LE MONDE!
$bar = ucfirst(strtolower($bar)); // Bonjour tout le monde!
?>
<?php
$str_first_cap = "hang on, this is first letter capital example!";
echo ucwords($str_first_cap);
?>
<?php
function strtoupperWithAccents($string) {
$string = strtoupper($string);
$string = str_replace(
array('é', 'è', 'ê', 'ë', 'à', 'â', 'î', 'ï', 'ô', 'ù', 'û'),
array('É', 'È', 'Ê', 'Ë', 'À', 'Â', 'Î', 'Ï', 'Ô', 'Ù', 'Û'),
$string
);
return $string;
}
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // show: MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
$my_string_in_uppercase = strtoupper($my_string);
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>