<?php const FOO = 1; const BAR = 2; function foo($mode = FOO) { } function bar($mode = FOO | BAR) { } $function = new ReflectionFunction(foo::class); foreach ($function->getParameters() as $param) { if (!defined("HHVM_VERSION")) { print $param->isDefaultValueConstant() ? "+ " : "- "; } print $param->getDefaultValueConstantName() . PHP_EOL; } print "-------------" . PHP_EOL; $function = new ReflectionFunction(bar::class); foreach ($function->getParameters() as $param) { if (!defined("HHVM_VERSION")) { print $param->isDefaultValueConstant() ? "+ " : "- "; } print $param->getDefaultValueConstantName() . PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.