php man page for splenum

Query: splenum

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

SPLENUM(3)								 1								SPLENUM(3)

The SplEnum class

INTRODUCTION
SplEnum gives the ability to emulate and create enumeration objects natively in PHP.
CLASS SYNOPSIS
SplEnum SplEnumextends SplType Constants o const NULL$SplEnum::__defaultnull Methods o public array SplEnum::getConstList ([bool $include_default = false]) Inherited methods o SplType::__construct ([mixed $initial_value], [bool $strict])
PREDEFINED CONSTANTS
o SplEnum::__default -
EXAMPLES
Example #1 SplEnum usage example <?php class Month extends SplEnum { const __default = self::January; const January = 1; const February = 2; const March = 3; const April = 4; const May = 5; const June = 6; const July = 7; const August = 8; const September = 9; const October = 10; const November = 11; const December = 12; } echo new Month(Month::June) . PHP_EOL; try { new Month(13); } catch (UnexpectedValueException $uve) { echo $uve->getMessage() . PHP_EOL; } ?> The above example will output: 6 Value not a const in enum Month PHP Documentation Group SPLENUM(3)
Related Man Pages
reflectionclass(3) - php
recursiveiteratoriterator(3) - php
reflectionproperty(3) - php
solrqueryresponse(3) - php
varnishlog(3) - php
Similar Topics in the Unix Linux Community
Forum Video Tutorial: How to Use Code Tags
Please Welcome Don Cragun as Lead Moderator
Status of UNIX.COM Forum Transformation
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Wolf Machowitsch
Please Welcome Nicki Paul to the Moderator Team!