2008/5/22 Stan Vassilev | FM <[EMAIL PROTECTED]>: > > 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. <?php function getArgs($s_Function, array $a_PassedParams = array()) { $a_Arguments = array(); if ('' !== $s_Function) { $rf_This = new ReflectionFunction($s_Function); foreach($rf_This->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!" -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php