downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<trimucwords>
Last updated: Thu, 26 Jun 2008

ucfirst

(PHP 4, PHP 5)

ucfirst — Make a string's first character uppercase

Description

string ucfirst ( string $str )

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

Note that 'alphabetic' is determined by the current locale. For instance, in the default "C" locale characters such as umlaut-a (ä) will not be converted.

Parameters

str

The input string.

Return Values

Returns the resulting string.

Examples

Example #1 ucfirst() example

<?php
$foo
= 'hello world!';
$foo = ucfirst($foo);            // Hello world!

$bar = 'HELLO WORLD!';
$bar = ucfirst($bar);            // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>



add a noteadd a note User Contributed Notes
Make a string's first character uppercase
There are no user contributed notes for this page.




<trimucwords>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs