Home >Backend Development >PHP Tutorial >The php ucwords function converts the first character of each word in the string to uppercase words download word download sight words

The php ucwords function converts the first character of each word in the string to uppercase words download word download sight words

WBOY
WBOYOriginal
2016-07-29 08:49:461381browse

php ucwords() function converts the first character of each word in the string to uppercase. This article introduces the basic usage and examples of 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( ) - Converts the first character in a string to uppercase

Syntax

<code>ucwords(string)</code>
Parameters Description
string Required. Specifies the string to be converted.

Technical details

Return value: Returns the converted string.
PHP version: 4+

Example

Convert the first character of each word to uppercase:

<?php
echo ucwords("hello world");
?>

Run online

Original address: http://www.manongjc. com/article/804.html

Related reading:

  • php tutorial
  • php overview
  • php environment construction
  • PHP writing format
  • php variables
  • php constants
  • PHP comments
  • php string string
  • PHP integer
  • PHP floating point float
  • php boolean
  • php data type array
  • php data type object
  • php data type null
  • Conversion between php data types

The above introduces the php ucwords function to convert the first character of each word in a string to uppercase, including words content. I hope it will be helpful to friends who are interested in PHP tutorials.

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