ucwords function in php

 Published April 23,2010 in PHP

Function Syntax:

string ucwords ( string str );


Function Details:

Returns a string with the first character of each word in str capitalized, if that character is alphabetic.

The definition of a word is any string of characters that is immediately after a whitespace (These are: space, form-feed, newline, carriage return, horizontal tab, and vertical tab).

Example 1. ucwords() example

$foo = 'hello world!';
$foo = ucwords($foo); //Output: Hello World!
 

Example 2. ucwords() example

$bar = 'HELLO WORLD!';
$bar = ucwords($bar); //Output: HELLO WORLD!
$bar = ucwords(strtolower($bar)); //Output: Hello World!

Was this information useful? What other tips would you like to read about in the future?  Share your comments, feedback and experiences with us by commenting below!



Like our site? Be a member of Coolajax fan page to get daily posts updates!

recommended-tutorial You May Like This Posts!

» How to strrpos function work?

» How to strstr function works?

» How to substr function works?

» How to str_rot13 function work?

» PHP Data Types

  tuts_view Total Read: 514
blog comments powered by Disqus

Topics

Coolajax Fans

coolajax fan page on Facebook