PHP ucwords()Functions

PHP String 参考手册PHP String Reference Manual

Examples

Convert the first character of each word to uppercase:

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

Run Example »

Definition and Usage

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

Note:This function is binary-safe.

Related functions:

  • ucfirst()- Converts the first character of a string to uppercase
  • lcfirst() - Converts the first character of a string to lowercase
  • strtoupper()- Converts a string to uppercase
  • strtolower()- Converts a string to lowercase

Syntax

ucwords(string)

Parameter Description
string Required. Specifies the string to convert.

Technical Details

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


PHP String 参考手册PHP String Reference Manual Other Extensions