Hi,
How can I return NULL with filter_input
when the input is empty?
$title = filter_input(INPUT_POST, 'title');
var_dump($title);
it returns,
string '' (length=0)
but I want,
null
Thanks.
Hi,
How can I return NULL with filter_input
when the input is empty?
$title = filter_input(INPUT_POST, 'title');
var_dump($title);
it returns,
string '' (length=0)
but I want,
null
Thanks.
You can only get NULL as the return value if the $variable is not set or fails to be filtered.
got it thank you. I think I have write a function or a couple of extra lines to return null for my case. thanks.