Re: Bug #15328: A C-like comma operator would be useful

From: Date: Fri, 01 Feb 2002 19:08:35 +0000
Subject: Re: Bug #15328: A C-like comma operator would be useful
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-78798@lists.php.net to get a copy of this message
--- brad lafountain <rodif_bl@yahoo.com> wrote: > > --- hek@loudoun-net.com wrote: > > From: hek@loudoun-net.com > > Operating system: N/A > > PHP version: 4.1.1 > > PHP Bug Type: Feature/Change Request > > Bug description: A C-like comma operator would be useful > > > > A C-like comma operator would be useful, to string together series of > > statements. > > > > Example: > > > > echo ( $precondition > > ? ( doThisAndDiscardReturnValue(), > > andDoThisAndReturnReturnValue() ) > > : doSomethingElseAndReturnReturnValue() ); > how about > > echo ($precondition ? ( doThisAndDiscardReturnValue() && > andDoThisAndReturnReturnValue() ) : doSomethingElseAndReturnReturnValue() ); sorry i guess i didn't read that good enough but then it makes less to me why you would wanna do that!!!!! becaues you always want doThisAndDiscardReturnValue() to execute. so why wouldn't you call it before you do you echo.. i would think your example would just be poor programming construct! this would work, doThisAndDiscardReturnValue(); echo ($precondition ? andDoThisAndReturnReturnValue() : doSomethingElseAndReturnReturnValue() ); > > this should work! > > > -- > > Edit bug report at: > > http://bugs.php.net/?id=15328&edit=1 > > > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > > For additional commands, e-mail: php-dev-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > __________________________________________________ > Do You Yahoo!? > Great stuff seeking new owners in Yahoo! Auctions! > http://auctions.yahoo.com > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com

« previous php.dev (#78798) next »