SplEnum
PHP Manual

SplEnum::__construct

(No version information available, might be only in CVS)

SplEnum::__constructConstructs an enumeger object type

Description

SplEnum::__construct ( void )

This constructor is used to set the value and the strictness of the "Enum" Object.

Liste de paramètres

input

The input parameter accepts an integer and will throw an UnexpectedValueException if anything else is passed.

strict

A boolean variable to indicate wether the object's strictness should be set or not.

Valeurs de retour

Aucune valeur n'est retournée.

Exemples

Exemple #1 SplEnum::__construct() example

<?php

class EnumOne extends SplEnum
{
    const 
__default 1;
}

class 
EnumTwo extends SplEnum
{
    const 
__default 2;
}

class 
EnumThree extends SplEnum
{
    const 
__default 3;
}

$enumOne   = new EnumOne();
$enumTwo   = new EnumTwo();
$enumThree = new EnumThree();


echo 
'Enum one  : ' $enumOne   PHP_EOL;
echo 
'Enum two  : ' $enumTwo   PHP_EOL;
echo 
'Enum three: ' $enumThree PHP_EOL;
?>

L'exemple ci-dessus va afficher :

Enum one  : 1
Enum two  : 2
Enum three: 3


SplEnum
PHP Manual