1$foo = 'hello world!';
2$foo = ucwords($foo); // Hello World!
3
4$bar = 'HELLO WORLD!';
5$bar = ucwords($bar); // HELLO WORLD!
6$bar = ucwords(strtolower($bar)); // Hello World!
7
8//With custom delimiter
9$foo = 'hello|world!';
10$bar = ucwords($foo); // Hello|world!
11
12$baz = ucwords($foo, "|");
1<?php
2/* Convert the first character of each word to uppercase: */
3echo ucwords("hello samy, how are you ?");
4
5//output : Hello Samy, How Are You ?
6?>
1
2<?php
3$foo = 'hello world!';
4$foo = ucwords($foo); // Hello World!
5
6$bar = 'HELLO WORLD!';
7$bar = ucwords($bar); // HELLO WORLD!
8$bar = ucwords(strtolower($bar)); // Hello World!
9?>
10
11