Initial-capping words is a very common task : String Case « String « PHP






Initial-capping words is a very common task

<?php
     $first_name = "jeremy";
     $last_name = "allen";
     $middle_init = "w";
   
     $first_name = ucfirst($first_name);
     $last_name = ucfirst($last_name);
     $middle_init = ucfirst($middle_init);
   
     print("$first_name $middle_init $last_name<br />");
   
     $name = "jeremy w allen";
     $name = ucwords($name);
   
     print($name . "<br />");
?>

           
       








Related examples in the same category

1.ucwords() function capitalizes the first letter of each word in a string
2.Change String case to lower
3.Change String case to Upper
4.Trimming Strings: chop