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
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
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
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)
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
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:
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.
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
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
Ó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 (
-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() (
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
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';
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.
14 matches
Mail list logo