<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionclass.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'reflectionclass.getmethods.php',
    1 => 'ReflectionClass::getMethods',
    2 => 'Gets an array of methods',
  ),
  'up' => 
  array (
    0 => 'class.reflectionclass.php',
    1 => 'ReflectionClass',
  ),
  'prev' => 
  array (
    0 => 'reflectionclass.getmethod.php',
    1 => 'ReflectionClass::getMethod',
  ),
  'next' => 
  array (
    0 => 'reflectionclass.getmodifiers.php',
    1 => 'ReflectionClass::getModifiers',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/reflection/reflectionclass/getmethods.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionclass.getmethods" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionClass::getMethods</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ReflectionClass::getMethods</span> &mdash; <span class="dc-title">Gets an array of methods</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionclass.getmethods-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionClass::getMethods</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Gets an array of methods for the class.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionclass.getmethods-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filter</code></dt>
     <dd>
      <p class="para">
       Filter the results to include only methods with certain attributes. Defaults
       to no filtering.
      </p>
      <p class="para">
       Any bitwise disjunction of <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-static">ReflectionMethod::IS_STATIC</a></code></strong>,
       <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-public">ReflectionMethod::IS_PUBLIC</a></code></strong>,
       <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-protected">ReflectionMethod::IS_PROTECTED</a></code></strong>,
       <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-private">ReflectionMethod::IS_PRIVATE</a></code></strong>,
       <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-abstract">ReflectionMethod::IS_ABSTRACT</a></code></strong>,
       <strong><code><a href="class.reflectionmethod.php#reflectionmethod.constants.is-final">ReflectionMethod::IS_FINAL</a></code></strong>,
       so that all methods with <em>any</em> of the given
       attributes will be returned.
      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: 
       <span class="simpara">
        Note that other bitwise operations, for instance <code class="literal">~</code>
        will not work as expected. In other words, it is not possible to
        retrieve all non-static methods, for example.
       </span>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionclass.getmethods-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   An <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of <span class="classname"><a href="class.reflectionmethod.php" class="classname">ReflectionMethod</a></span> objects
   reflecting each method.
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-reflectionclass.getmethods-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.2.0</td>
      <td>
       <code class="parameter">filter</code> is nullable now.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-reflectionclass.getmethods-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Basic usage of <span class="methodname"><strong>ReflectionClass::getMethods()</strong></span></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">Apple </span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">firstMethod</span><span style="color: #007700">() { }<br />    final protected function </span><span style="color: #0000BB">secondMethod</span><span style="color: #007700">() { }<br />    private static function </span><span style="color: #0000BB">thirdMethod</span><span style="color: #007700">() { }<br />}<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">'Apple'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$methods </span><span style="color: #007700">= </span><span style="color: #0000BB">$class</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMethods</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$methods</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">array(3) {
  [0]=&gt;
  object(ReflectionMethod)#2 (2) {
    [&quot;name&quot;]=&gt;
    string(11) &quot;firstMethod&quot;
    [&quot;class&quot;]=&gt;
    string(5) &quot;Apple&quot;
  }
  [1]=&gt;
  object(ReflectionMethod)#3 (2) {
    [&quot;name&quot;]=&gt;
    string(12) &quot;secondMethod&quot;
    [&quot;class&quot;]=&gt;
    string(5) &quot;Apple&quot;
  }
  [2]=&gt;
  object(ReflectionMethod)#4 (2) {
    [&quot;name&quot;]=&gt;
    string(11) &quot;thirdMethod&quot;
    [&quot;class&quot;]=&gt;
    string(5) &quot;Apple&quot;
  }
}</pre>
</div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Example #2 Filtering results from <span class="methodname"><strong>ReflectionClass::getMethods()</strong></span></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">Apple </span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">firstMethod</span><span style="color: #007700">() { }<br />    final protected function </span><span style="color: #0000BB">secondMethod</span><span style="color: #007700">() { }<br />    private static function </span><span style="color: #0000BB">thirdMethod</span><span style="color: #007700">() { }<br />}<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">'Apple'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$methods </span><span style="color: #007700">= </span><span style="color: #0000BB">$class</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMethods</span><span style="color: #007700">(</span><span style="color: #0000BB">ReflectionMethod</span><span style="color: #007700">::</span><span style="color: #0000BB">IS_STATIC </span><span style="color: #007700">| </span><span style="color: #0000BB">ReflectionMethod</span><span style="color: #007700">::</span><span style="color: #0000BB">IS_FINAL</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$methods</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">array(2) {
  [0]=&gt;
  object(ReflectionMethod)#2 (2) {
    [&quot;name&quot;]=&gt;
    string(12) &quot;secondMethod&quot;
    [&quot;class&quot;]=&gt;
    string(5) &quot;Apple&quot;
  }
  [1]=&gt;
  object(ReflectionMethod)#3 (2) {
    [&quot;name&quot;]=&gt;
    string(11) &quot;thirdMethod&quot;
    [&quot;class&quot;]=&gt;
    string(5) &quot;Apple&quot;
  }
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionclass.getmethods-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="reflectionclass.getmethod.php" class="methodname" rel="rdfs-seeAlso">ReflectionClass::getMethod()</a> - Gets a ReflectionMethod for a class method</span></li>
    <li><span class="function"><a href="function.get-class-methods.php" class="function" rel="rdfs-seeAlso">get_class_methods()</a> - Gets the class methods' names</span></li>
   </ul>
  </p>
 </div>


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