Re: substr/array_slice in []
| From: | Richard Quadling | Date: | Tue, 09 Oct 2007 10:47:18 +0000 |
| Subject: | Re: substr/array_slice in [] | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32715@lists.php.net to get a copy of this message | ||
On 09/10/2007, Scott MacVicar <scott@macvicar.net> wrote:
> Sure it works fine when it's been in the language for several years and
> it's guaranteed to be available in the version provided by your hosting
> company.
>
> In reality this isn't the case with PHP so everyone will end up using
> the older method to support backwards compatibility or mixing it and
> causing confusion.
>
> Scott
OOI. If the ISP is not on the version which would have this particular
"feature", how would I create a fallback solution for my clients?
Something like PEAR's PHP Compat library. Very useful for giving
support to newer functionality.
I think I wouldn't bother with the new feature for a while. Maybe if
it was major version only (V5 vs V6 is nice and clean, but V5.2.4 vs
V5.2.5 is not so easy for some clients to understand that new
functionality - rather than bug fixes - requires an upgrade).
But having a working method already seems redundant, simply for syntactic sugar.
>
> Stefan Walk wrote:
> > Antony Dovgal wrote:
> >> Right, so let's force other people to learn crappy unreadable syntax
> >> duplicating nice and clear function call
> > Oddly, this "crappy unreadable syntax" doesn't lead to any confusion or
> > complaints for newbies of languages like python or ruby, judging from
> > the IRC channels. And it's also odd that ruby users, where String#[] is
> > just an alias for String#slice, prefer this "crappy unreadable syntax"
> > over a "nice and clear" method call. One starts to wonder ...
> >
> > Regards,
> > Stefan
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"