Revision: 40113
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 26, 2011 09:55 by kendsnyder
Initial Code
function firstTruthy(/*$value1, $value2, $valueN...*/) { $args = func_get_args(); foreach ($args as $a) { if (!!$a) { return $a; } } return null; }
Initial URL
Initial Description
Can be used like SQL COALESCE, IFNULL or for defaulting if a value is falsy
Initial Title
Find first truthy value
Initial Tags
Initial Language
PHP