Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60667 invoked by uid 1010); 10 Oct 2007 07:38:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60652 invoked from network); 10 Oct 2007 07:38:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2007 07:38:07 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.146.182 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.146.182 wa-out-1112.google.com Received: from [209.85.146.182] ([209.85.146.182:45062] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/B0-55062-C518C074 for ; Wed, 10 Oct 2007 03:38:05 -0400 Received: by wa-out-1112.google.com with SMTP id l24so148847waf for ; Wed, 10 Oct 2007 00:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=DtrN3MExRm+F+uHWKU5VuNHB2JbgV3wq64jMbqDJdXE=; b=Ahrk8cqhoUtTNVVBRIIQs51C5KjOjbdP/18zmy0/8HZ0+iYR4Ae/YSBagKd34e//MX+OUxURs3Y2BoG9zEnebRN9QgtYlLsTqbdMjMccbZ9wekxTkpIrMDtWwclevWty6tCqH3/n8CGtvRHKg7NwKQA+1zg/K3OLG4KzA2F2VTY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=lNtFcQodHediVB8xzntthMO7pJ3XWjkIWkDHoj3M6DtQpJ5TdHqBGdb5T47K3rA19ICiy6JlKLqwiaW44vuIR8WcHhXWx0wMVWBaM4u14CylAvtwIKYjYLlwnDjuEKIoS3jD9zDL7a97OrB/SOtWVFBRqleQXqpVOgLMrf3G0DE= Received: by 10.114.92.2 with SMTP id p2mr457688wab.1192001881210; Wed, 10 Oct 2007 00:38:01 -0700 (PDT) Received: by 10.115.59.1 with HTTP; Wed, 10 Oct 2007 00:38:01 -0700 (PDT) Message-ID: <10845a340710100038p562cc239n29a412dc84650859@mail.gmail.com> Date: Wed, 10 Oct 2007 08:38:01 +0100 Reply-To: RQuadling@GoogleMail.com To: "PHP Internals List" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Q. zend_parse_parameters() - allow grouping of optional parameters. From: rquadling@googlemail.com ("Richard Quadling") Hi. From what I understand about the argument list for zend_parse_parameters(), you separate optional parameters from mandatory ones using pipe (|). e.g. if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|llll", &m, &d, &y, &h, &n, &s, &ms) == FAILURE) { In the above example, this says that there are 3 mandatory parameters and upto 4 optional parameters. The prototype for this looks like ... proto bool myExampleDateFunc(int month, int day, int year, [int hour [, int min [, int sec [,int msec]]]]) Is there a way to make the prototype ... proto bool myExampleDateFunc(int month, int day, int year, [int hour, int min, int sec[, int msec]]) So, making this function accept 3 or 6 or 7 parameters only. I'm guessing not, but I'm guessing. I think this has to be checked using ... switch (ZEND_NUM_ARGS()) { after parsing the parameters and generate an error for ZEND_NUM_ARGS = 4 or 5. Regards, Richard. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"