[PHP-NOTES] note 130474 added to function.filter-var

[email protected] ("[email protected]") Mon, 08 Sep 2025 11:14:09 +0000
Newsgroups php.notes
Message-ID <[email protected]>
Note that: when using FILTER_VALIDATE_INT, if the variable is zero, the "if" will be false.

<?php
$var = 0;

if (!filter_var($var, FILTER_VALIDATE_INT)){
    echo "Zero = false";
} else {
    echo 'Will not pass here";
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 200.153.25.250)
----
Manual Page -- https://php.net/manual/en/function.filter-var.php
Edit        -- https://main.php.net/note/edit/130474
Del: integrated  -- https://main.php.net/note/delete/130474/integrated
Del: useless     -- https://main.php.net/note/delete/130474/useless
Del: bad code    -- https://main.php.net/note/delete/130474/bad+code
Del: spam        -- https://main.php.net/note/delete/130474/spam
Del: non-english -- https://main.php.net/note/delete/130474/non-english
Del: in docs     -- https://main.php.net/note/delete/130474/in+docs
Del: other reasons-- https://main.php.net/note/delete/130474
Reject      -- https://main.php.net/note/reject/130474
Search      -- https://main.php.net/manage/user-notes.php