Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21574 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1184 invoked by uid 1010); 19 Jan 2006 04:30:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1169 invoked from network); 19 Jan 2006 04:30:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2006 04:30:38 -0000 Received: from ([127.0.0.1:10916]) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with ECSTREAM id DC/FD-17857-EE51FC34 for ; Wed, 18 Jan 2006 23:30:38 -0500 X-Host-Fingerprint: 24.202.48.157 modemcable157.48-202-24.mc.videotron.ca Received: from ([24.202.48.157:5243] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id B2/4D-17857-EF01FC34 for ; Wed, 18 Jan 2006 23:09:34 -0500 Message-ID: To: internals@lists.php.net Date: Wed, 18 Jan 2006 23:09:19 -0500 User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 References: <11370812947200000@9866357972520000.9866341568840000> <43C688AE.80403@php.net> <43C69B2A.8000802@php.net> <21.B4.29075.F75A6C34@pb1.pair.com> <54.A8.13436.BE6F9C34@pb1.pair.com> <7.0.1.0.2.20060115112107.06375638@zend.com> <57792e850601171808x540205b9ubc81e2f1475a3ae9@mail.gmail.com> <90e24d4e0601172348k1275e5cey17ce74ace3ebadff@mail.gmail.com> In-Reply-To: <90e24d4e0601172348k1275e5cey17ce74ace3ebadff@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 24.202.48.157 Subject: Re: [PHP-DEV] Re: Named arguments revisited From: xenon54@generationphp.net (Xenon_54) > Just to throw in my two cents since every one else has (not that my 2 > cents is worth anything more than just that), but isn't it as easy as > doing something like the following: > > (using pseudo example from above) > > function db_connect($params) { > $host = 'localhost'; > $user = 'root'; > $password = ''; > $port = 3301; > extract($params, EXTR_OVERWRITE); > // ... more code here > } > > This covers the default parameters in a clean fashion which is easy to > understand and should be readable to anyone who knows PHP in even the > slightest fashion. I think you should use EXTR_IF_EXISTS instead of EXTR_OVERWRITE. I guess you don't want undefined arguments to be defined by the user. Just adding my 2 cents too.