Hi,
How can I return NULL with `filter_input` when the input is empty?
it returns,PHP Code:$title = filter_input(INPUT_POST, 'title');
var_dump($title);
but I want,PHP Code:string '' (length=0)
Thanks.PHP Code:null
| SitePoint Sponsor |



Hi,
How can I return NULL with `filter_input` when the input is empty?
it returns,PHP Code:$title = filter_input(INPUT_POST, 'title');
var_dump($title);
but I want,PHP Code:string '' (length=0)
Thanks.PHP Code:null

You can only get NULL as the return value if the $variable is not set or fails to be filtered.
Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
Having lame problems with your code? Let us help by using a jsFiddle



Bookmarks