in reply to ucfirst(uclast(lc($user))) ?

An alternative is:

$user = reverse(ucfirst(reverse(ucfirst(lc $user))));

I'm NOT saying this is less excessive :^)

..Guv

Replies are listed 'Best First'.
Re: Re: ucfirst(uclast(lc($user))) ?
by Kanji (Parson) on Mar 10, 2002 at 21:53 UTC

    While it may be the least readable solution of the bunch (IMHO, thanks to the parens; YMMV... ), adapted to work as a uclast function, it's the speediest of the bunch ...

    # Output reformatted for readability :) Benchmark: running juerd, seattlejohn, theguvnor, each for at least 5 CPU seconds... juerd: 6 wallclock secs ( 5.18 usr + 0.00 sys = 5.18 CPU) @ 20926.21/s (n=108335) seattlejohn: 6 wallclock secs ( 5.36 usr + 0.00 sys = 5.36 CPU) @ 47568.95/s (n=254922) theguvnor: 5 wallclock secs ( 5.33 usr + 0.00 sys = 5.33 CPU) @ 103021.21/s (n=548897) Rate juerd seattlejohn theguvnor juerd 20926/s -- -56% -80% seattlejohn 47569/s 127% -- -54% theguvnor 103021/s 392% 117% --

      Sweet - I have now become a subroutine! And I'm reasonably fast!! :) Kanji++

      ..Guv