Convert the first character of each word to uppercase:
<?php
echo ucwords("hello world");
?>
Try it Yourself »
The ucwords() function converts the first character of each word in a string to uppercase.
Note: This function is binary-safe.
Related functions:
ucwords(
string,
delimiters)
Parameter | Description |
---|---|
string | Required. Specifies the string to convert |
delimiters | Optional. Specifies the word separator character |
Return Value: | Returns the converted string |
---|---|
PHP Version: | 4+ |
Changelog: | PHP 5.4 - Added the delimiters parameter |
Convert the first character of each word to uppercase, with a custom word separator added:
<?php
echo ucwords("hello|world", "|");
?>
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!