Re: Seeking 'coalesce' php internal function
| From: | D. Dante Lorenso | Date: | Wed, 03 May 2006 23:47:25 +0000 |
| Subject: | Re: Seeking 'coalesce' php internal function | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23136@lists.php.net to get a copy of this message | ||
Rick Widmer wrote:
D. Dante Lorenso wrote:No, that doesn't address the problem. See this: ---------- 8< -------------------- 8< -------------------- 8< ---------- <pre> <?php function ifsetor() { $args = func_get_args(); $count = count($args); for ($i=0; $i<$count; $i++) {Eric, This reply is too basic and is not the answer. The problem is more complex then you have grasped.function ifsetor() { $args = func_get_args(); $count = count( $args ); for( $i=0; $i<$count; $i++ ) { if isset( $args[ $i ] )) {return $args[ $i ];} return false; }
if (isset($args[$i])) {
return $args[$i];
}
}
return false;
}
print ifsetor($x, $y, $z, "dante")."\n";
?>
</pre>
PHP Notice: Undefined variable: x in .../ifsetor.php on line 13
PHP Notice: Undefined variable: y in .../ifsetor.php on line 13
PHP Notice: Undefined variable: z in .../ifsetor.php on line 13
---------- 8< -------------------- 8< -------------------- 8< ----------
See my post regarding a specification for 'filled()' as a function. An important feature is that warnings about unset variables should not occur. Your suggestion does not qualify. This problem can not be solved in userspace.
Dante