I honestly don't really care about the performance side of things, I'd
be very surprised if this sort of calculation is going to be in the top
5 bottlenecks of an application. However, from a development point of
view I do find $a{-1} a much shorter and cleaner way of calculating an
end-of-string offset and would like to see it implemented.
On Mon, 2004-11-01 at 09:44, Ilia Alshanetsky wrote:
> IMO {-1} syntax is not only faster but simpler to use then the
> equivalent substr() (for read) or $a[strlen($a) - 1] (for write). While
> my reasons are primarily performance based, I think that most people
> would find the {-1} simpler to use as well.
>
> Ilia
>
> Sterling Hughes wrote:
> > i hope not. this should be about what's cool for developers, the
> > speed increase is not a compelling reason.. the debate is "does this
> > make code easier to read/write/maintain?" I think it doesn't, and
> > therefore am against it.
> >
> > -sterling
> >
> >
> > On Mon, 1 Nov 2004 03:04:45 +0100, Marcus Boerger <[EMAIL PROTECTED]> wrote:
> >
> >>Hello Wez,
> >>
> >> well it would. However 5.1 aims to be a major speed improvement and that's
> >>what the idea is about.
> >>
> >>best regards
> >>marcus
> >>
> >>
> >>
> >>Monday, November 1, 2004, 2:29:46 AM, you wrote:
> >>
> >>
> >>>Doesn't substr($a, -1) work ?
> >>
> >>>--Wez.
> >>
> >>>On Sun, 31 Oct 2004 17:45:03 -0500, Greg Beaver <[EMAIL PROTECTED]> wrote:
> >>>
> >>>>It would reduce the errors I inevitably get
> >>>>whenever using a complex feature like substr(). The three choices:
> >>>>
> >>>>1) substr($a, strlen($a) - 1);
> >>>>2) $a{strlen($a) - 1}
> >>>>3) $a{-1}
> >>>>
> >>>>It's pretty obvious that the 3rd choice lowers the potential for all
> >>>>kinds of bugs (mistypign, wrong parameter name, incorrect parameter
> >>>>placement), and is much more readable. For those who already know how
> >>>>{} works in PHP, it's also obvious what it does at the first look
> >>>>without any speculation.
> >>
> >>--
> >>Best regards,
> >> Marcus mailto:[EMAIL PROTECTED]
> >>
> >>--
> >>PHP Internals - PHP Runtime Development Mailing List
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php