Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23132 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92012 invoked by uid 1010); 3 May 2006 21:18:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 91997 invoked from network); 3 May 2006 21:18:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2006 21:18:38 -0000 X-PHP-List-Original-Sender: dante@vocalspace.com X-Host-Fingerprint: 69.56.193.72 fox02.stravio.com Linux 2.5 (sometimes 2.4) (4) Received: from ([69.56.193.72:48197] helo=fox02.stravio.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E6/FE-63443-E2E19544 for ; Wed, 03 May 2006 17:18:38 -0400 Received: from [127.0.0.1] (unknown [66.243.31.162]) by fox02.stravio.com (Postfix) with ESMTP id 1C5BC26C2EC; Wed, 3 May 2006 16:18:35 -0500 (CDT) Message-ID: <44591E27.4030005@vocalspace.com> Date: Wed, 03 May 2006 16:18:31 -0500 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: dante@lorenso.com Cc: internals@lists.php.net References: <44584619.60400@lorenso.com> In-Reply-To: <44584619.60400@lorenso.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Specification for function filled() :: was ifsetor/coalesce From: dante@vocalspace.com ("D. Dante Lorenso") Dear Internals, I'd like a white bikeshed, but until you can decide on a color, how about we just build the bikeshed already. Please consider the following specification: ========== 8< ==================== 8< ==================== 8< ========== filled (PHP 5.2.0) filled - Find first non-empty value in a variable list where empty() evaluates as FALSE. Description ------------------------------ mixed filled ( mixed varname [, mixed ...] ) filled() takes a variable number of parameters. For each of these, *filled()* looks for a variable where !empty( varname ) evaluates as TRUE. It returns the first non-empty value or NULL if all values are empty(). Note: filled() only checks variables as anything else will result in a parse error. In other words, the following will not work: filled(trim($name)). filled() is the opposite of empty(), and no warning is generated when any one of the variables is not set. Return Values ------------------------------ Returns first non-empty() value. If all values are empty(), returns NULL. Example ------------------------------ See also empty() ========== 8< ==================== 8< ==================== 8< ========== Dante