note 106307 modified in filter.filters.validate by danbrown

From: Date: Wed, 26 Oct 2011 19:39:40 +0000
Subject: note 106307 modified in filter.filters.validate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184150@lists.php.net to get a copy of this message
It's important to note that in PHP, false==null is true. This means when you are using the FILTER_VALIDATE_BOOLEAN, you must use '===' and '!==' to check to see if something is/isn't null. <?php $false = filter_var('0', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if ($false==null) { //will execute } if ($false===null) { //will not execute } ?> --was-- It's important to note that in PHP, false==null is true. This means when you are using the FILTER_VALIDATE_BOOLEAN, you must use '===' and '!==' to check to see if something is/isn't null. $false = filter_var('0', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if ($false==null) { //will execute } if ($false===null) { //will not execute } http://php.net/manual/en/filter.filters.validate.php

« previous php.notes (#184150) next »