<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionproperty.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'reflectionproperty.getdoccomment.php',
    1 => 'ReflectionProperty::getDocComment',
    2 => 'Gets the property doc comment',
  ),
  'up' => 
  array (
    0 => 'class.reflectionproperty.php',
    1 => 'ReflectionProperty',
  ),
  'prev' => 
  array (
    0 => 'reflectionproperty.getdefaultvalue.php',
    1 => 'ReflectionProperty::getDefaultValue',
  ),
  'next' => 
  array (
    0 => 'reflectionproperty.gethook.php',
    1 => 'ReflectionProperty::getHook',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/reflection/reflectionproperty/getdoccomment.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionproperty.getdoccomment" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionProperty::getDocComment</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ReflectionProperty::getDocComment</span> &mdash; <span class="dc-title">Gets the property doc comment</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionproperty.getdoccomment-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionProperty::getDocComment</strong></span>(): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Gets the doc comment for a property.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionproperty.getdoccomment-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionproperty.getdoccomment-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The doc comment if it exists, otherwise <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-reflectionproperty.getdoccomment-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="methodname"><strong>ReflectionProperty::getDocComment()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Str<br /></span><span style="color: #007700">{<br />    </span><span style="color: #FF8000">/**<br />     * @var int  The length of the string<br />     */<br />    </span><span style="color: #007700">public </span><span style="color: #0000BB">$length </span><span style="color: #007700">= </span><span style="color: #0000BB">5</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$prop </span><span style="color: #007700">= new </span><span style="color: #0000BB">ReflectionProperty</span><span style="color: #007700">(</span><span style="color: #DD0000">'Str'</span><span style="color: #007700">, </span><span style="color: #DD0000">'length'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$prop</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDocComment</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">string(53) &quot;/**
     * @var int  The length of the string
     */&quot;</pre>
</div>
    </div>
   </div>
  </p>

  <p class="para">
   <div class="example" id="example-2">
    <p><strong>示例 #2 Multiple property declarations</strong></p>
    <div class="example-contents"><p>
     If multiple property declarations are preceeded by a single doc comment,
     the doc comment refers to the first property only.
    </p></div>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Foo<br /></span><span style="color: #007700">{<br />    </span><span style="color: #FF8000">/** @var string */<br />    </span><span style="color: #007700">public </span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">$class </span><span style="color: #007700">= new </span><span style="color: #0000BB">\ReflectionClass</span><span style="color: #007700">(</span><span style="color: #DD0000">'Foo'</span><span style="color: #007700">);<br />foreach (</span><span style="color: #0000BB">$class</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProperties</span><span style="color: #007700">() as </span><span style="color: #0000BB">$property</span><span style="color: #007700">) {<br />    echo </span><span style="color: #0000BB">$property</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getName</span><span style="color: #007700">() . </span><span style="color: #DD0000">': ' </span><span style="color: #007700">. </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">$property</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDocComment</span><span style="color: #007700">(), </span><span style="color: #0000BB">true</span><span style="color: #007700">) . </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">a: &#039;/** @var string */&#039;
b: false</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionproperty.getdoccomment-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="reflectionproperty.getmodifiers.php" class="methodname" rel="rdfs-seeAlso">ReflectionProperty::getModifiers()</a> - Gets the property modifiers</span></li>
    <li><span class="methodname"><a href="reflectionproperty.getname.php" class="methodname" rel="rdfs-seeAlso">ReflectionProperty::getName()</a> - Gets property name</span></li>
    <li><span class="methodname"><a href="reflectionproperty.getvalue.php" class="methodname" rel="rdfs-seeAlso">ReflectionProperty::getValue()</a> - Gets value</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>