Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21485 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64339 invoked by uid 1010); 12 Jan 2006 13:33:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64324 invoked from network); 12 Jan 2006 13:33:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2006 13:33:28 -0000 X-Host-Fingerprint: 195.141.85.117 uf1.search.ch Linux 2.4/2.6 Received: from ([195.141.85.117:57022] helo=verksam.search.ch) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 4D/40-29075-7AA56C34 for ; Thu, 12 Jan 2006 08:33:28 -0500 Received: from localhost (localhost [127.0.0.1]) by verksam.search.ch (Postfix) with ESMTP id E996D3A01F1; Thu, 12 Jan 2006 14:33:23 +0100 (CET) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXWT4fGm; Thu, 12 Jan 2006 14:33:23 +0100 (CET) Received: by verksam.search.ch (Postfix, from userid 65534) id 2580A3A0227; Thu, 12 Jan 2006 14:33:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on verksam.search.ch X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.1.0 Received: from [192.168.1.72] (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by verksam.search.ch (Postfix) with ESMTP id 3F5503A01F1; Thu, 12 Jan 2006 14:33:22 +0100 (CET) Message-ID: <43C65AA1.60002@cschneid.com> Date: Thu, 12 Jan 2006 14:33:21 +0100 User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050715) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jason Garber Cc: Aidan Lister , internals@lists.php.net References: <56.50.29075.176B5C34@pb1.pair.com> <157554660.20060112012542@ionzoft.com> In-Reply-To: <157554660.20060112012542@ionzoft.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at search.ch Subject: Re: [PHP-DEV] Re: Named arguments revisited From: cschneid@cschneid.com (Christian Schneider) Jason Garber wrote: > Here is a coding idea for you, in case you hadn't considered it... > > function highlight($text=NULL, $needle=NULL, $strip_links=NULL, ...) > { > is_null($text) && $text = SOME DEFAULT VALUE; > is_null($needle) && $text = SOME DEFAULT VALUE; > is_null($strip_links) && $text = SOME DEFAULT VALUE; > ... > } We use function highlight($p = array()) { $p += array( # Also serves as documentation 'text' => SOME_DEFAULT_VALUE, 'needle' => SOME_DEFAULT_VALUE, 'strip_links' => SOME_DEFAULT_VALUE, ... ); } ... $highlight(array('strip_links' => true)); in cases just like this. Plus the patch from to get $highlight('strip_links' => true); If named parameters for PHP are considered in the future then my main wish would be that there is a catch-all array receiving all the non-assignable parameters. - Chris