--TEST-- ReflectionParameter class - isOptional, isDefaultValueAvailable and getDefaultValue methods. --CREDITS-- Robin Fernandes Steve Seear --FILE-- getParameters(); echo "parameter names from staticMethod method:\n\n"; foreach($refParameters as $parameter) { var_dump($parameter); if($parameter->isOptional()) { echo "this parameter is optional\n"; } else { echo "this parameter is not optional\n"; } if($parameter->isDefaultValueAvailable()) { echo "this parameter has a default value\n"; } else { echo "this parameter has no default value\n"; } /* $val = 0; try { $val = $parameter->getDefaultValue(); var_dump($val); } catch (ReflectionException $e) { print $e->getMessage(); echo "\n"; } */ echo "\n"; } ?> --EXPECTF-- hello from test third is jack Notice: Undefined variable: theIncrement in %s on line 8 parameter names from staticMethod method: object(ReflectionParameter)#%d (1) { ["name"]=> string(8) "paramOne" } this parameter is not optional this parameter has no default value object(ReflectionParameter)#%d (1) { ["name"]=> string(12) "anotherParam" } this parameter is optional this parameter has a default value object(ReflectionParameter)#%d (1) { ["name"]=> string(10) "thirdParam" } this parameter is optional this parameter has a default value object(ReflectionParameter)#%d (1) { ["name"]=> string(10) "arrayParam" } this parameter is optional this parameter has a default value