help with ltrim and ucfirst

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gammaman
Forum Commoner
Posts: 45
Joined: Tue Feb 12, 2008 9:22 am

help with ltrim and ucfirst

Post by gammaman »

lets say I have a statement $var= " name";

How would I combine ltrim and ucfirst togther to get $var="Name";
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: help with ltrim and ucfirst

Post by Christopher »

Since the first character is a space, you don't want to uppercase it. As I recall uppercase spaces are very similar to lowercase spaces in appearance. So it looks like you should trim first and then uppercase.
(#10850)
Post Reply