<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.enumerations.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'language.enumerations.overview.php',
    1 => 'Enumerations overview',
    2 => 'Enumerations overview',
  ),
  'up' => 
  array (
    0 => 'language.enumerations.php',
    1 => 'Enumerations',
  ),
  'prev' => 
  array (
    0 => 'language.enumerations.php',
    1 => 'Enumerations',
  ),
  'next' => 
  array (
    0 => 'language.enumerations.basics.php',
    1 => 'Basic enumerations',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/enumerations.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="language.enumerations.overview" class="sect1">
   <h2 class="title">Enumerations overview</h2>
   <p class="verinfo">(PHP 8 &gt;= 8.1.0)</p>

   <p class="para">
    Enumerations, or &quot;Enums&quot;, allow a developer to define a custom type that is limited to one
    of a discrete number of possible values. That can be especially helpful when defining a
    domain model, as it enables &quot;making invalid states unrepresentable.&quot;
   </p>

   <p class="para">
    Enums appear in many languages with a variety of different features. In PHP,
    Enums are a special kind of object. The Enum itself is a class, and its possible
    cases are all single-instance objects of that class. That means Enum cases are
    valid objects and may be used anywhere an object may be used, including type checks.
   </p>

   <p class="para">
    The most popular example of enumerations is the built-in boolean type, which is an
    enumerated type with legal values <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    Enums allows developers to define their own arbitrarily robust enumerations.
   </p>
  </div><?php manual_footer($setup); ?>