There is one case though, which can still not be implemented (probably?) by
users, and that's a coalesce function, since that would require fetching
values by using func_get_args(), which doesn't return references.
So the only way I could imagine implementing such coalesce() function would
be like
At 17:10 14/06/2005, Sven Fuchs wrote:
> This implementation of issetor() actually works fine, except it does
> pollute the symbol tables with empty variables ($a and $b in this
> examples are created, as nulls).
What are the consequences of polluting the symbol tables this way?
Well, it will
Personally, I doubt this is a problem.. I mean, how many ifsetor() variables
are we talking here? You call the function, so therefor the variable could
be set, otherwise you wouldn't be checking for it. In the case it was set,
it would've been in the symbol table anyway.
Ron
"Sven Fuchs" <[EMAIL
Personally, I doubt this is a problem.. I mean, how many ifsetor() variables
are we talking here? You call the function, so therefor the variable could
be set, otherwise you wouldn't be checking for it. In the case it was set,
it would've been in the symbol table anyway.
Ron
"Sven Fuchs" <[EMAIL
> This implementation of issetor() actually works fine, except it does
> pollute the symbol tables with empty variables ($a and $b in this
> examples are created, as nulls).
What are the consequences of polluting the symbol tables this way?
Should this issetor() be considered a "bad practice", pro
No, ifsetor() is not possible in user land, because it generates notices,
and a php core function ifsetor() would not generate notices. That's really
the way it has to be.
Ron
"Sven Fuchs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Why isn't is possible in userland? Is there a
Why isn't is possible in userland? Is there any problem with using
this?
function ifsetor(&$var, $default = null) {
return isset($var) ? $var : $default;
}
echo ifsetor($a, 'foo');
echo $a, $b;
echo ifsetor($a, 'foo');
echo isset($a) ? 'is set' : 'not set';
expected result:
foo
Notice: Und
Hello Ilia,
Wednesday, February 2, 2005, 7:04:24 PM, you wrote:
IA> The end result is that we are punishing people who have already written
IA> good code and continue to encourage people to write bad code by saying
IA> "we'll take care of data filtering", which is sorta like safe_mode.