Re: RFC: blank() Function as a Complement to empty()
>If this can still be implemented in userland you don't need logic integrated at low level
Afaik it cannot be implemented in userland today.
The closest you can get today is to use reference hacks, which
introduce side-effects, like if you do
function blank(&$value){...}
blank($_POST['foo'])
and foo doesn't exist, the & ref will *create* foo with null, like
var_dump($_POST); // array(0) {}
blank($_POST['foo']);
var_dump($_POST); // array(1) {["foo"]=>NULL}
But maybe we could make it possible like
function blank(#[\AllowUndeclared] $value){...}
var_dump($_POST); // array(0) {}
blank($_POST['foo']);
var_dump($_POST); // array(0) {}
Thread (16 messages)