Re: ifsetor like expression in php6

From: Date: Sat, 26 Jan 2008 21:23:51 +0000
Subject: Re: ifsetor like expression in php6
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-34946@lists.php.net to get a copy of this message
On Sat, 2008-01-26 at 22:13 +0100, Lars Strojny wrote: > Hi, > > Am Samstag, den 26.01.2008, 12:17 -0500 schrieb Sam Barrow: > > I don't think throwing a E_NOTICE is appropriate. The isset() construct > > doesn't throw an E_NOTICE, this shouldn't either. > > As far as I understand it is just an extension to the already present > tertiary operator and therefore the ifsetor would be > isset($_GET['foo']) ?: 'bar'. This doesn't work how you think... if $_GET['foo'] is set then the return value is true and not the value of $_GET['foo']. > I don't understand why that sugar should > act anything different and not trigger an E_NOTICE. I thought it was supposed to be a shortcut for doing the following: $foo = isset( $_GET['foo'] ) ? $_GET['foo'] : 'xyz'; And I thought the whole point was for it to not generate a notice. Isn't that why the name ifsetor was chosen? Since it's supposed to work like isset() by not generating notices? Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.internals (#34946) next »