Answers for "capitalize first letter php function"

PHP
6

php ucfirst all words

$foo = 'hello world!';
$foo = ucwords($foo);             // Hello World!

$bar = 'HELLO WORLD!';
$bar = ucwords($bar);             // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!

//With custom delimiter
$foo = 'hello|world!';
$bar = ucwords($foo);             // Hello|world!

$baz = ucwords($foo, "|");
Posted by: Guest on July-07-2020
2

ucfirst

<?php
/* Convert the first character of "hello" to uppercase:  */
echo ucfirst("hello samy!");

//output : Hello samy!
?>
Posted by: Guest on June-23-2020

Code answers related to "capitalize first letter php function"

Browse Popular Code Answers by Language