The problem with implementing "ifsetor", "filled", or "??" in userland
is that the "not set" or "undefined" warning is fired before the
variable is passed to the underlying function/method.
Is it possible to add a modifier that turns off warnings for undefined
variables whenever that specific method is called? Something like:
class Utility {
public silent function filled() {
$args = func_get_args();
foreach ($args as $arg) {
if (!empty($arg)) { return $arg; }
}
return false;
}
}
$x = Utility::filled($my_undef, $x['undef'], $nosuch, 'default');
The modifier "silent" will turn all undefined or "not isset()" variables
into NULL values when being passed to the method and no warnings will be
issued.
Then, we can build our own damn functions as we see fit without the fuss.
-- Dante
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php