<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.classobj.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.get-declared-classes.php',
    1 => 'get_declared_classes',
    2 => 'Returns an array with the name of the defined classes',
  ),
  'up' => 
  array (
    0 => 'ref.classobj.php',
    1 => 'Classes/Object Functions',
  ),
  'prev' => 
  array (
    0 => 'function.get-class-vars.php',
    1 => 'get_class_vars',
  ),
  'next' => 
  array (
    0 => 'function.get-declared-interfaces.php',
    1 => 'get_declared_interfaces',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/classobj/functions/get-declared-classes.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.get-declared-classes" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_declared_classes</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">get_declared_classes</span> &mdash; <span class="dc-title">Returns an array with the name of the defined classes</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.get-declared-classes-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>get_declared_classes</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Gets the declared classes.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.get-declared-classes-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.get-declared-classes-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array of the names of the declared classes in the current
   script.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Note that depending on what extensions you have compiled or
    loaded into PHP, additional classes could be present. This means that
    you will not be able to define your own classes using these
    names. There is a list of predefined classes in the <a href="reserved.classes.php" class="link">Predefined Classes</a> section of
    the appendices.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.get-declared-classes-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.4.0</td>
      <td>
       Previously <span class="function"><strong>get_declared_classes()</strong></span> always returned parent classes before
       child classes. This is no longer the case. No particular order is guaranteed
       for the <span class="function"><strong>get_declared_classes()</strong></span> return value.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.get-declared-classes-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>get_declared_classes()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">get_declared_classes</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
something similar to:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [0] =&gt; stdClass
    [1] =&gt; __PHP_Incomplete_Class
    [2] =&gt; Directory
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.get-declared-classes-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.class-exists.php" class="function" rel="rdfs-seeAlso">class_exists()</a> - Checks if the class has been defined</span></li>
    <li><span class="function"><a href="function.get-declared-interfaces.php" class="function" rel="rdfs-seeAlso">get_declared_interfaces()</a> - Returns an array of all declared interfaces</span></li>
    <li><span class="function"><a href="function.get-defined-functions.php" class="function" rel="rdfs-seeAlso">get_defined_functions()</a> - Returns an array of all defined functions</span></li>
   </ul>
  </p>
 </div>

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