[dev] Re: [cvs] commit: imp/lib IMP.php

Jon Parise jon at horde.org
Thu Feb 20 02:50:27 PST 2003


On Wed, Feb 19, 2003 at 04:24:55PM -0600, Eric Rostetter wrote:

> > mikec       2003/02/16 18:36:07 PST
> > 
> >   Modified files:
> >     lib                  IMP.php
> >   Log:
> >   save a strlen call
> > 
> >   Revision  Changes    Path
> >   1.367     +4 -4      imp/lib/IMP.php
> > 
> >   Chora Links:
> >   http://cvs.horde.org/diff.php/imp/lib/IMP.php?r1=1.366&r2=1.367&ty=u
> 
> Is the optimization here worth the loss of clarity (ease to read)? Or
> am I the only one who finds this more difficult to read?
 
I agree.  If the optimization is really worth it, the code would read
better if $prefixLen was assigned on its own line, e.g.:

    $prefix = IMP::preambleString();
    $prefixLen = strlen($prefix);
    if (substr($folder, 0, $prefixLen) == $prefix) {
        $folder = substr($folder, $prefixLen);
    }

-- 
Jon Parise (jon at horde.org) :: The Horde Project (http://horde.org/)


More information about the dev mailing list