php

PHP – Uppercase the first letter of each word in a string

In this tutorial, we are going to see how to uppercase the first letter of each word in a string in PHP. You can use PHP’s ucwords() function to change the first letter of a string to upper case.
 

Uppercase the first letter of each word in a string
<?php
  $str = "welcom to stackhowto";
  echo ucwords($str);
?>

Output:

Welcom To Stackhowto
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *