note 48089 deleted from function.func-get-arg by googleguy

From: Date: Tue, 22 Oct 2013 10:13:25 +0000
Subject: note 48089 deleted from function.func-get-arg by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196908@lists.php.net to get a copy of this message
Note Submitter: bishop ---- Regarding a "deferment" operator for dvogel at ssc dot wisc dot edu, pick your poison: <?php // using ternary operators function pick($a,$b) { return (isset($a) ? $a : $b); } $a = (pick($b,$c) ? pick($c,$d) : null); ?> <?php // using varargs function function pick($a) { $argc = func_num_args(); for ($i = 0; $i < $argc; $i++) { $arg = func_get_arg($i); if (! is_null($arg)) { return $arg; } } return null; } $a = pick($b, $c, $d); ?>

« previous php.notes (#196908) next »