Ólafur Waage wrote:
While researching for this suggestion I found this rfc proposal regarding
ifsetor() (
http://wiki.php.net/rfc/ifsetor?s[]=isset<http://wiki.php.net/rfc/ifsetor?s%5B%5D=isset>)
and it's rejection point was that it was currently not possible (
http://marc.info/?l=php-internals&m=108931281901389&w=2 )
But would it be possible to check for a value of a variable if it is set?
Since I often do (and see others do)
if(isset($_GET["foo"]) && $_GET["foo"] == "bar")
or even worse
if((isset($_GET["foo"]) && $_GET["foo"] == "bar") || (isset($_GET["baz"]) &&
$_GET["baz"] == "bat"))
to be able to do something like this
if(isset($_GET["foo"]) == "bar")
or
if(isset($_GET["foo"]) == "bar" || isset($_GET["baz"]) == "bat")
That isset (or some other language construct) would return the variable if
it were set and false if it was not.
Thanks for your time, i know this has probably been talked to death in one
form or other.
Yes. Beaten it has been. I still want my function: filled(...). I
described the spec here:
http://marc.info/?l=php-internals&m=114677154729359&w=2
You would use it like the opposite of "empty" but it takes an arbitrary
number of parameters and returns the first value where empty() would
evaluate as false. Like isset() and empty(), it would do so without
throwing any notices:
$x = filled($y["maybe"], $obj->tryit, $z['a']['b']['c'], $default);
Would it be a timesaver and very useful? You bet! That was 2006. Good
luck getting anything changed.
-- Dante
----------
D. Dante Lorenso
da...@lorenso.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php