- PHP

Make first letter capital in PHP

PHP has its own function to make the first letter of a string capital.

To use it, just place the string inside the ucfirst() function, like in the following example.

Example:

<?php
    $string = 'dog';
    $newString = ucfirst($string);

    echo $newString;
?>

Output: Dog