note 96740 deleted from function.array-filter by cmb

From: Date: Sun, 06 Oct 2019 08:12:50 +0000
Subject: note 96740 deleted from function.array-filter by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212498@lists.php.net to get a copy of this message
Note Submitter: Ant P. ---- If you're using filter_input_array, the values will be null on failure and anything else on success. Because array_filter by default removes false, 0 and "" you need to do extra work like this: <?php $input_array = filter_input_array(INPUT_GET, array( 'var1' => FILTER_VALIDATE_BOOLEAN, 'var2' => FILTER_VALIDATE_INT )); array_filter($input_array, function($a) { return !is_null($a) }); ?>

« previous php.notes (#212498) next »