Re: [PHP-DEV] ifsetor like expression in php6

2008-01-27 Thread Marcus Boerger
Hello Sam, as others pointed out & results in unwanted entries being present. So the second time you use ifsetor on those entries, you do not get the default back but rather NULL. Actually in your implementation you never get the default back. Please read the archives, all of this has been disc

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Sam Barrow
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

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Lars Strojny
Hi, Am Samstag, den 26.01.2008, 22:43 +0100 schrieb Johannes Schlüter: [...] > ?: operator > [DOC] "expr1 ?: expr1" is a shortcut for: "expr1 > ? expr1 : expr2" as exists in gcc and discussed some time back. Note > that this is not an implementation ifsetor($var, default). While > ifsetor wou

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Lars Strojny
Hi, Am Samstag, den 26.01.2008, 16:23 -0500 schrieb Robert Cummings: [...] > 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']. Hm, check what happens: $b = array(false, false); var_dump($b[0] ?: "sdf"); This will return

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Johannes Schlüter
Hi, On Sat, 2008-01-26 at 16:23 -0500, Robert Cummings wrote: > 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? This thing is not called "ifsetor". From the commi

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Robert Cummings
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

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Lars Strojny
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 i

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Hannes Magnusson
On Jan 26, 2008 5:30 PM, Sebastian <[EMAIL PROTECTED]> wrote: > hi, > > i just found the new ifsetor like construction in php6. (FYI: It has already been merged to 5.3) -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Etienne Kneuss
Hi, usage of references here have some bad consequences, it will pollute the input array with null entries: function foo(&$a) { } var_dump(array_key_exists('inexistent', $_GET)); // bool(false) foo($_GET['inexistent']); var_dump(array_key_exists('inexistent', $_GET)); // bool(true) will actually

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Stefan Walk
On Saturday 26 January 2008 18:22:09 Sam Barrow wrote: > I'm sorry I misunderstood. If specifying like "$var ?: 5" then it should > throw an E_NOTICE, as this is a conditional that checks the value of a > variable ($var). > > Sebastian, for assigning of a default value is a variable is not set, I >

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread Sam Barrow
I'm sorry I misunderstood. If specifying like "$var ?: 5" then it should throw an E_NOTICE, as this is a conditional that checks the value of a variable ($var). Sebastian, for assigning of a default value is a variable is not set, I would recommend using something like this (this is what I use):

Re: [PHP-DEV] ifsetor like expression in php6

2008-01-26 Thread 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. On Sat, 2008-01-26 at 17:30 +0100, Sebastian wrote: > hi, > > i just found the new ifsetor like construction in php6. It left me the > question why php has to throw an E_NOTI