Re: [PHP-DEV] The constant use of isset()

2009-05-13 Thread Ólafur Waage
2009/5/12 Ionut Gabriel Stan ionut.g.s...@gmail.com 2009/5/13 Ólafur Waage olaf...@gmail.com: 2009/5/12 Brian Moon br...@moonspot.net $foo = filter_input(INPUT_GET, foo, FILTER_UNSAFE_RAW); That would have a value if set or null if not set. It also allows you to validate it using

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Olivier B.
So if the variable is set and contains false, we can't check it ? And near same problem for 0, empty array and empty string. But you can also use this syntax : (yes it's not very clean) if( @$_GET['foo'] === 'bar') or if( @$_GET['foo'] === 'bar' or @$_GET['baz'] === 'bat' ) Olivier

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Sean Coates
So if the variable is set and contains false, we can't check it ? And near same problem for 0, empty array and empty string. How would you ever get false (the value, not the string) into a request variable? (without setting it that way after the request init, that is) S -- PHP

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Olivier B.
Sean Coates a écrit : So if the variable is set and contains false, we can't check it ? And near same problem for 0, empty array and empty string. How would you ever get false (the value, not the string) into a request variable? (without setting it that way after the request init, that is)

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Ólafur Waage
The error suppression was discussed in the rfc and yes it is not clean and you could be suppressing something else inadvertently. Yes the false value would be an issue with this, but for 0, empty array and empty string is an issue with just about anything else in PHP already. Hence === if you

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Sean Coates
So this isset() behavior will only be available for request variable, not for all variables ? I'm not picking sides, but that seems to me like the overwhelmingly popular use case. S -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Lewis Wright
Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set'; It works in just the same way and has no problems. I agree it would be great though if there could be a function to retrieve a variable's value if it exists, without throwing an error if it doesn't exist.

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Ionut G. Stan
Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set'; It works in just the same way and has no problems. I agree it would be great though if there could be a function to retrieve a variable's value if it exists, without throwing an error if it doesn't

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Robert Cummings
On Tue, 2009-05-12 at 18:23 +0100, Lewis Wright wrote: Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set'; It works in just the same way and has no problems. I agree it would be great though if there could be a function to retrieve a variable's

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread D. Dante Lorenso
Ólafur Waage wrote: While researching for this suggestion I found this rfc proposal regarding ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=issethttp://wiki.php.net/rfc/ifsetor?s%5B%5D=isset) and it's rejection point was that it was currently not possible (

RE: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Jared Williams
-Original Message- From: Ólafur Waage [mailto:olaf...@gmail.com] Sent: 12 May 2009 17:35 To: internals@lists.php.net Subject: [PHP-DEV] The constant use of isset() While researching for this suggestion I found this rfc proposal regarding ifsetor() (

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Ólafur Waage
On Tue, May 12, 2009 at 5:39 PM, Robert Cummings rob...@interjinn.comwrote: On Tue, 2009-05-12 at 18:23 +0100, Lewis Wright wrote: Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set'; It works in just the same way and has no problems. I agree it

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Robert Cummings
On Tue, 2009-05-12 at 19:35 +, Ólafur Waage wrote: On Tue, May 12, 2009 at 5:39 PM, Robert Cummings rob...@interjinn.comwrote: On Tue, 2009-05-12 at 18:23 +0100, Lewis Wright wrote: Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set';

Re: [PHP-DEV] The constant use of isset()

2009-05-12 Thread Ólafur Waage
2009/5/12 Brian Moon br...@moonspot.net $foo = filter_input(INPUT_GET, foo, FILTER_UNSAFE_RAW); That would have a value if set or null if not set. It also allows you to validate it using filters if you wanted to. This of course only works with GPC variables, but it is a great solution.