Topic: PHP's ucfirst()

Is this function a perfect commentary on PHP's bloat, or what? big_smile
The same effect could be achieved in a much more powerful way with $foo[0] = strtoupper($foo[0]). Yes, it's a bit more code, but surely not enough to justify a new function.
I can't believe this is in the core. hmm

Re: PHP's ucfirst()

lol

Well, they're not short on supporting the user's every need and whim

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus

Re: PHP's ucfirst()

You're gonna love ucwords() - Uppercase the first character of each word in a string

In any case, PHP isn't C, and the bloat is part of php's strenght (...and weakness...)

Trust me, I know what I'm doing.

Re: PHP's ucfirst()

i didn't know that strings in php are stored as arrays. is that for reals?

at least we can all see a need for an mb-safe ucfirst() and uswords(), right?

Re: PHP's ucfirst()

i didn't know that strings in php are stored as arrays. is that for reals?

As far as I know they're not, atleast not in a way that should be of any real concern (Like in C).

$var[n] is just an easy way to access the nth character in a string.
This is also the reason you must always quote the name of the key you're trying to access in an array (ie $array['5'] or $array["$i"]).

Trust me, I know what I'm doing.

Re: PHP's ucfirst()

thanks for the tip. i just wrote this line in a client's project:

<h1><?php echo ucfirst($action)." categories for ".strtolower($name); ?></h1><br />

big_smile

i wish there was an lcfirst(), though. sad yikes

Last edited by lucas (2007-05-29 21:22:59)