Home >Backend Development >PHP Tutorial >The php ucwords() function converts the first character of each word in the string to uppercase (implementation code)

The php ucwords() function converts the first character of each word in the string to uppercase (implementation code)

高洛峰
高洛峰Original
2017-01-03 14:25:351375browse

php ucwords() function converts the first character of each word in the string to uppercase. This article introduces the basic usage and examples of the php ucwords() function to coders. Interested coders can refer to it.

Definition and usage

ucwords() function converts the first character of each word in the string to uppercase.

Note: This function is binary safe.

Related functions:

lcfirst() - Convert the first character in the string to lowercase

strtolower() - Convert the string to lowercase

strtoupper() - Convert the string to uppercase

ucfirst() - Convert the first character in the string to uppercase

Syntax ucwords(string)

php ucwords() 函数将字符串中每个单词的首字符转换为大写(实现代码)

Technical details

php ucwords() 函数将字符串中每个单词的首字符转换为大写(实现代码)

Example

Convert the first character of each word to uppercase:

< ?phpecho ucwords("hello world");?>

The above php ucwords() function converts the first character of each word in the string to uppercase (implementation code) is what I share with you The entire content is here, I hope it can give everyone a reference, and I also hope everyone will support the PHP Chinese website.

For more php ucwords() function, convert the first character of each word in the string to uppercase (implementation code), please pay attention to the PHP Chinese website for related articles!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn