note 126263 added to function.empty

From: Date: Thu, 22 Jul 2021 09:11:51 +0000
Subject: note 126263 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-216634@lists.php.net to get a copy of this message
Multiple empty(): <?php /** * Multiple empty(). * * @param mixed[] $vars Variables to test * @return bool */ function multi_empty(& ...$vars) { // no callback is supplied, all empty values will be removed return array_filter($vars) === []; } ?> example: <?php $notEmptyVar = 1; $emptyVar = null; // $undefinedVar - not defined multi_empty($emptyVar); // true multi_empty($emptyVar, $undefinedVar); // true multi_empty($notEmptyVar , $emptyVar); // false multi_empty($notEmptyVar , $emptyVar, $undefinedVar); // false ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 31.129.215.166) ---- Manual Page -- https://php.net/manual/en/function.empty.php Edit -- https://main.php.net/note/edit/126263 Del: integrated -- https://main.php.net/note/delete/126263/integrated Del: useless -- https://main.php.net/note/delete/126263/useless Del: bad code -- https://main.php.net/note/delete/126263/bad+code Del: spam -- https://main.php.net/note/delete/126263/spam Del: non-english -- https://main.php.net/note/delete/126263/non-english Del: in docs -- https://main.php.net/note/delete/126263/in+docs Del: other reasons-- https://main.php.net/note/delete/126263 Reject -- https://main.php.net/note/reject/126263 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216634) next »