note 75734 added to ref.filter

From: Date: Wed, 13 Jun 2007 18:15:15 +0000
Subject: note 75734 added to ref.filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-127455@lists.php.net to get a copy of this message
There is an undocumented filter flag for FILTER_VALIDATE_BOOLEAN. The documentation implies that it will return NULL if the value doesn't match the allowed true/false values. However this doesn't happen unless you give it the FILTER_NULL_ON_FAILURE flag like this: <?php $value = 'car'; $result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); ?> In the above $result will equal NULL. Without the extra flag it would equal FALSE, which isn't usually a desired result for this specific filter. ---- Server IP: 87.124.64.96 Probable Submitter: 88.96.15.166 ---- Manual Page -- http://www.php.net/manual/en/ref.filter.php Edit -- https://master.php.net/note/edit/75734 Del: integrated -- https://master.php.net/note/delete/75734/integrated Del: useless -- https://master.php.net/note/delete/75734/useless Del: bad code -- https://master.php.net/note/delete/75734/bad+code Del: spam -- https://master.php.net/note/delete/75734/spam Del: non-english -- https://master.php.net/note/delete/75734/non-english Del: in docs -- https://master.php.net/note/delete/75734/in+docs Del: other reasons-- https://master.php.net/note/delete/75734 Reject -- https://master.php.net/note/reject/75734 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127455) next »