Text transformation in PHP is useful not just for esthetics, but to also make sure that data is uniform when dealing with databases and such.
strtolower()
- https://www.php.net/manual/en/function.strtolower.php
- https://www.w3schools.com/php/func_string_strtolower.asp
strtoupper()
- https://www.php.net/manual/en/function.strtoupper.php
- https://www.w3schools.com/php/func_string_strtoupper.asp
ucfirst()
- https://www.php.net/manual/en/function.ucfirst.php
- https://www.w3schools.com/php/func_string_ucfirst.asp
ucwords()
- https://www.php.net/manual/en/function.ucwords.php
- https://www.w3schools.com/php/func_string_ucwords.asp
textTransform.php
<?php
$string = "hello my Name is BOB. WhAt is YOUr name?";
echo $string;
echo "<br><br>";
echo strtolower($string);
echo "<br><br>";
echo strtoupper($string);
echo "<br><br>";
echo ucfirst($string);
echo "<br><br>";
echo ucwords($string);
echo "<br><br>";
$string = strtolower($string);
echo ucwords($string);
?>
Be the first to comment