• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • ReflectionParameter::isDefaultValueConstant()

    (PHP 5 >= 5.4.6, PHP 7)

    Returns whether the default value of this parameter is a constant

    说明

    publicReflectionParameter::isDefaultValueConstant(void) : bool

    Returns whether the default value of this parameter is a constant.

    参数

    此函数没有参数。

    返回值

    ReturnsTRUEif the default value is constant,andFALSEotherwise.

    参见

    • ReflectionParameter::getDefaultValueConstantName() Returns the default value's constant name if default value is constant or null
    • ReflectionParameter::isDefaultValueAvailable() 检查是否有默认值。
    This method returns true only if the parameter's default value is set to a named constant. e.g.
    class Foo {
      const OPTION_MULTIGET = 1;
      //Method 1
      public function setGetOptions($opts=0);
      //Method 2
      public function setMultiGetOptions($opts=Foo::OPTION_MULTIGET);
    }
    Method 1's first ReflectionParameter will return isDefaultValueConstant() = false (0 is a "constant"/static value but not a named constant) and Method 2's will return isDefaultValueConsntant() = true.