<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="reflectionparameter.getdefaultvalueconstantname" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>ReflectionParameter::getDefaultValueConstantName</refname>
  <refpurpose>Returns the default value's constant name if default value is constant or null</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="ReflectionParameter">
   <modifier>public</modifier> <type class="union"><type>string</type><type>null</type></type><methodname>ReflectionParameter::getDefaultValueConstantName</methodname>
   <void/>
  </methodsynopsis>
  <para>
   Returns the default value's constant name of the parameter of any user-defined
   or internal function or method, if default value is constant or null.
   If the parameter is not optional a <classname>ReflectionException</classname>
   will be thrown.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  &no.function.parameters;
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns string on success or &null; on failure.
  </para>
 </refsect1>

  <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>8.0.0</entry>
       <entry>
        This method now allows getting the default values' constant names of built-in functions and
        built-in class methods. Previously, a <classname>ReflectionException</classname> was thrown.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Getting default values' constant names of function parameters</title>
    <programlisting role="php">
<![CDATA[
<?php
function foo($test, $bar = PHP_INT_MIN)
{
    echo $test . $bar;
}

$function = new ReflectionFunction('foo');

foreach ($function->getParameters() as $param) {
    echo 'Name: ' . $param->getName() . PHP_EOL;
    if ($param->isOptional()) {
        echo 'Default value: ' . $param->getDefaultValueConstantName() . PHP_EOL;
    }
    echo PHP_EOL;
}
?>
]]>
    </programlisting>
    &example.outputs;
   <screen>
<![CDATA[
Name: test

Name: bar
Default value: PHP_INT_MIN
]]>
   </screen>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>ReflectionParameter::isOptional</methodname></member>
    <member><methodname>ReflectionParameter::isDefaultValueConstant</methodname></member>
    <member><methodname>ReflectionParameter::getDefaultValue</methodname></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
