Re: RFC - Array slice syntactic sugar

From: Date: Fri, 20 Mar 2015 20:33:34 +0000
Subject: Re: RFC - Array slice syntactic sugar
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-85326@lists.php.net to get a copy of this message
> > There’s no existing unary form of * and ^, though, so I think they’d both > be available in this context (^ is my preference). I think that is also my preference too. On 20 March 2015 at 20:17, John Bafford <jbafford@zort.net> wrote: > > On Mar 20, 2015, at 16:10, Sean Coates <sean@seancoates.com> wrote: > > >> I posted four suggestions earlier, > >> > >> They were: > >> > >> @ > >> & > >> * > >> ^ > >> > >> My favourites are the asterisk or caret. > > > > That’s no different than @ being invalid because it’s > > already in use. > > > > $ php -a > > Interactive shell > > > > php > define('a', 1); > > php > define('b', 2); > > php > echo @a . "\n"; > > 1 > > php > echo (a&b) . "\n"; > > 0 > > php > echo (a*b) . "\n"; > > 2 > > php > echo (a^b) . "\n"; > > 3 > > php > > > > > However: ☃ has a long history of being available to PHP. > > > > S > > > > There’s no existing unary form of * and ^, though, so I think they’d both > be available in this context (^ is my preference). > > Overloading unary & would probably also work in this context, but > personally, I think that & is too overused. > > -John

« previous php.internals (#85326) next »