[UPHPU] reassigning foreach function opposed to all at once
Scott Hill
llihttocs at gmail.com
Thu Apr 12 10:03:43 MDT 2007
On 4/11/07, Wade Preston Shearer <lists at wadeshearer.com> wrote:
>
> Is there a performance difference between…
>
> $pretty_user_url = substr($author->user_url, 7);
> $pretty_user_url = str_ireplace('www.', '', $pretty_user_url);
> $pretty_user_url = rtrim($pretty_user_url, '/');
>
>
> …and…
>
> $pretty_user_url = rtrim(str_ireplace('www.', '', substr($author-
> >user_url, 7)), '/');
>
>
> …or is it just a preference of legibility?
Most of the time I HAVE to do it long hand just so I can figure out how it
works or try to keep straight in my mind what I am trying to do. Sometimes,
after I get it working, I change it to a one liner just to impress someone
who may see the code in the future. Most of the time, it's not worth the
effort because it either breaks and I have to spend time troubleshooting or
no one ever sees the code. In other words (after all that), I usually
prefer the first example so that it's easier for ME to figure it out later.
--
Scott Hill
"May you solve interesting problems" - Author Unknown
"A fanatic is one who can't change his mind and won't change the subject." -
Sir Winston Churchill
More information about the UPHPU
mailing list