How to use php ucwords function

藏色散人
Release: 2023-04-06 19:12:01
Original
2748 people have browsed it

php The ucwords function is used to convert the first character of each word to uppercase and return the converted string; the syntax is "ucwords(string)", and the parameter string is used to specify the string to be converted.

How to use php ucwords function

php ucwords

Function: Convert the first character of each word to uppercase

Syntax:

ucwords(string)
Copy after login

Parameters:

string Required, specifies the string to be converted

Description: Convert the first character of each word in the string to uppercase, this function Is binary safe.

php ucwords() function usage example 1:

<?php
$i = "hello world";
$j = ucwords($i);
echo $j;
?>
Copy after login

Output:

Hello World
Copy after login

php ucwords() function usage example 2:

<?php
$i = "I&#39;m study in php.cn";
$j = ucwords($i);
echo $j;
?>
Copy after login

Output:

I&#39;m Study In Php.cn
Copy after login

The above is the detailed content of How to use php ucwords function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!