note 111633 deleted from function.isset by aharvey

From: Date: Mon, 11 Mar 2013 16:20:36 +0000
Subject: note 111633 deleted from function.isset by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194031@lists.php.net to get a copy of this message
Note Submitter: elad(d0t)berger(a)gmail(d0t)c0m ---- <?php /** * Determine if a variable is set and is not NULL * If so return his value, otherwise return the default value * * @param array $vars * @param mixed $default * @return mixed */ function multiplyIsSetOr($vars, $default = null) { foreach($vars as &$var) { if( ! empty($var)) { return $var; } } return $default; } // Demo $id = multiplyIsSetOr([ &$_GET['id'], &$argv[2], ], 'none'); var_dump($id); ?>

« previous php.notes (#194031) next »