I'm a little confused with the benefit of using filter_has_var($_POST['id'])
over isset($_POST['id'])
.
Can Somebody please tell me if it's simply an alias function?
Not alot ;) According to the manual page for filter_has_var one user finds filter_has_var
a little quicker. Also worth noting... filter_has_var
isn't working on the live array ($_POST
) but on the actual provided input... if you ever add/remove/update what's in that array you won't see those changes with a filter_has_var
call (while isset
will reflect the current state)
By the way the usage is filter_has_var(INPUT_POST,"id");
Update: Perhaps worth mentioning, filter_has_var
was introduced in PHP 5.2.0 (somewhat new) while isset
has been around for all of PHP4+5. Most servers keep up to date on this, but isset
will always work (no one still runs PHP3 do they?)
First of all, it's not
filter_has_var($_POST['id'])
It's
filter_has_var(INPUT_POST, 'id')
Secondly, it doesn't actually query the $_POST
superglobal. It analyzes the request parameter that came in with the request, so it's a better method to use in case $_POST
gets dirtied in some way by the PHP script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With