Posted By

Wardy on 12/05/08


Tagged

php text capitalise


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

vali29
fwd
piotrlewandowski


php - Capitalise First Letter of Words


 / Published in: PHP
 

URL: http://www.devchunks.com/string/use-php-to-capitalise-your-text/

First Remove all capital letters, then capitalise the first ones in each word.

  1. echo ucfirst (strtolower('FROGS EAT DOGS ON LOGS.')); # outputs: Frogs eat dogs on logs.

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: pgl on December 6, 2008

See also:

  • http://php.net/ucwords
Posted By: iloveitaly on May 29, 2009

What would be nice is a function that capitalized a title (ie didn't capitalize words like a, to, the, etc).

You need to login to post a comment.