Re: Construct Request

From: Date: Fri, 16 Apr 2004 07:46:20 +0000
Subject: Re: Construct Request
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-9250@lists.php.net to get a copy of this message
On Fri, 16 Apr 2004, Andi Gutmans wrote: > At 02:21 PM 4/15/2004 -0400, Sean Coates wrote: > >Andi Gutmans wrote: > >>It could be implemented but I don't see the big advantage over $bar ? 0 : > >>$base > >>It's one character... > >>oes to GCC and its C extension). > >>>> $bar ? : $baz; > >>>> If $bar evaluates to true, the [whole] expression evaluates to $bar > >>>> or to [$baz], respectively. (I had a zero in my example, changed the example, but not the sentence.) > >if ($foo) $variable = $foo; else $variable = $bar; Right. > I have to read closer next time. Personally I prefer finding a user-land > solution and not a new syntax. All these "weird" operators look like all of > the weird Perl stuff. I never felt that C looks like Perl at all. Remember that the operator usage as proposed originates in GCC land, because "a?:b" is a frequent usage pattern - at least in C. - Sascha

« previous php.internals (#9250) next »