Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10728 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45878 invoked by uid 1010); 23 Jun 2004 15:04:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43849 invoked from network); 23 Jun 2004 15:04:45 -0000 Received: from unknown (HELO hyperion-data.net) (204.200.195.9) by pb1.pair.com with SMTP; 23 Jun 2004 15:04:45 -0000 Received: from hyperion-data.net (localhost [127.0.0.1]) by hyperion-data.net (8.12.11/8.12.6) with ESMTP id i5NF4iJj064136 for ; Wed, 23 Jun 2004 15:04:44 GMT (envelope-from daniel@hyperion-data.net) Received: from localhost (daniel@localhost) by hyperion-data.net (8.12.11/8.12.6/Submit) with ESMTP id i5NF4hjv064121 for ; Wed, 23 Jun 2004 15:04:43 GMT (envelope-from daniel@hyperion-data.net) Date: Wed, 23 Jun 2004 15:04:43 +0000 (GMT) To: internals@lists.php.net Message-ID: <20040623150429.E62456@hyperion-data.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: keyword arguments? From: daniel@hyperion-data.net (Daniel Crookston) It looks like the last time this was discussed was October of 2003, over the course of about five emails. I don't see anything in the archives about it since then. Here's what I'd like to suggest. some_function($a, 'B', :check TRUE) function some_function($first, $second, :check $key1 = FALSE, :foo $key2) { if ($key1) { lala; } elseif ($key2 > 0) { blabla; } } Sticking a : in front of the variable name, either in the calling code or the function declaration, makes it a keyword argument. Keyword arguments are always optional, and [could|should] default to something handy like FALSE or 0. (Maybe make their defaults settable in php.ini?) I would implement this myself, but even after reading George Schlossnagle's fantastic book, I'm still not wizardly enough to do so. If someone could point me in the right direction, though... Thanks for listening, Daniel