On Mon, 2008-07-21 at 22:06 +0200, Paweł Stradomski wrote:
> W liście Rasmus Lerdorf z dnia poniedziałek, 21 lipca 2008:
> > It also isn't any shorter:
> >
> >    if(str_endswith($path,'.php'))
> >
> >    vs.
> >
> >    if(substr($path,-4)=='.php')
> 
> Only if comparing to a static string, but not for this case:
> 
> if (substr($path, -strlen($extension)) == $extension)

Then $extension is a CV which isn't that much slower in comparison as a
CONST, so from engine-performance-perspective: no big deal -> spend your
time optimizing on other places where it has more effect than the time
you loose on teaching people about all the fancy string functions (where
we already have more than enough)

> Readability would also increase.

too many functions hurt more on readability imo ...

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to