Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37800 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3579 invoked from network); 22 May 2008 11:58:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 May 2008 11:58:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 72.14.220.153 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: 72.14.220.153 fg-out-1718.google.com Received: from [72.14.220.153] ([72.14.220.153:51378] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/90-34040-EDF55384 for ; Thu, 22 May 2008 07:58:24 -0400 Received: by fg-out-1718.google.com with SMTP id 16so6519fgg.23 for ; Thu, 22 May 2008 04:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; bh=iV6EYw1UINAbWsV72joCwWYgPqjjrlnp8KL6H62HVP4=; b=o5Z/7pziYFknjT4LYGZZGlvcSW3zzCn8OKegAPewhbiyJ+geWctyz16UM4MkGoreLcWxMMpeTs6v73re3iPPjZhnWWkx7mfHhjexSzhADoAQJXzutIMDGiX+gNxTjrntUbZjJKTBiigMjoEWJ4TwvqP8dcJ1/CYzRgzSMa0wHhw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=M5bnVH+ulcqymM5AH8MUfpznwWOfKpzCRbr38RD1wHUbDjFfBlqcPzV7DkmeqqWMzNm4EAq/nGTzIRK55Bu6KxS9Maykfjj1KfQUT6wjKV62lmpWysgXX3Hp3bXUnx680IomVV5rryO2GcR0mIEzKl0jnD7iSO7jIP3c0i7ZK5Q= Received: by 10.86.4.2 with SMTP id 2mr21993fgd.40.1211457499387; Thu, 22 May 2008 04:58:19 -0700 (PDT) Received: by 10.86.60.20 with HTTP; Thu, 22 May 2008 04:58:19 -0700 (PDT) Message-ID: <10845a340805220458i3f44bdf0p4d9d3f452ebc5c32@mail.gmail.com> Date: Thu, 22 May 2008 12:58:19 +0100 Reply-To: RQuadling@GoogleMail.com To: "Stan Vassilev | FM" Cc: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [PHP-DEV] Getting Default Values via reflection. From: rquadling@googlemail.com ("Richard Quadling") 2008/5/22 Stan Vassilev | FM : > > Hi, > > Actually PHP ignores default values on parameters followed by required ones. > You can't fetch the default value even via Reflection. > This is easily detected at compile time so I wonder why the compiler doesn't > warn. > > Regards, > Stan Vassilev I'm not sure this is what you mean, but I use the following function in my debugging logic. getParameters() as $i_Param => $rp_Param) { $a_Arguments[$rp_Param->getName()] = $i_Param < count($a_PassedParams) ? $a_PassedParams[$i_Param] : $rp_Param->getDefaultValue() . ' (Default)'; } } return $a_Arguments; } function foo($required, $optional = 'snafu', $also_optional = 'sins') { print_r(getArgss(__FUNCTION__, func_get_args())); } foo('fred'); foo('bob', 'jim'); outputs ... Array ( [required] => fred [optional] => snafu (Default) [also_optional] => sins (Default) ) Array ( [required] => bob [optional] => jim [also_optional] => sins (Default) ) -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"