note 129129 added to function.filter-var
| From: | RandomGuy at main dot php dot net | Date: | Thu, 28 Dec 2023 09:15:51 +0000 |
| Subject: | note 129129 added to function.filter-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221083@lists.php.net to get a copy of this message | ||
Actually, this is not really a helpful comment for a manual (so, don't upvote), but as search
engines don't find a lot of occurrences for the error message and especially no helpful hint,
it might save somebody some time.
If you're getting an error message like "filter_var(): Unknown filter with ID
2097152" or a different number, you just accidentally mixed up the parameters. So, instead of
<?php
filter_var($ip, FILTER_FLAG_IPV6)
?>
you should try it with
<?php
filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
?>
and it will work ;) I know, this isn't the most intuitive form you can design a function and
it's tempting to throw everything into one param as it is done for regular checks, but, yeah,
it is how it is.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 31.19.238.161)
----
Manual Page -- https://php.net/manual/en/function.filter-var.php
Edit -- https://main.php.net/note/edit/129129
Del: integrated -- https://main.php.net/note/delete/129129/integrated
Del: useless -- https://main.php.net/note/delete/129129/useless
Del: bad code -- https://main.php.net/note/delete/129129/bad+code
Del: spam -- https://main.php.net/note/delete/129129/spam
Del: non-english -- https://main.php.net/note/delete/129129/non-english
Del: in docs -- https://main.php.net/note/delete/129129/in+docs
Del: other reasons-- https://main.php.net/note/delete/129129
Reject -- https://main.php.net/note/reject/129129
Search -- https://main.php.net/manage/user-notes.php