Login   Register  
PHP Classes
elePHPant
Icontem

File: Enumeration.test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jim Sierra  >  PHP Enumeration  >  Enumeration.test.php  >  Download  
File: Enumeration.test.php
Role: Example script
Content type: text/plain
Description: Use example
Class: PHP Enumeration
Provide enumerated data type with constants
Author: By
Last change:
Date: 2008-08-07 14:03
Size: 381 bytes
 

Contents

Class file image Download
<?php
require 'Enumeration.class.php';

Class 
testEnum extends baseEnum
{
    const 
value1='One';
    const 
value2='Two';
    const 
value3='Three';

    
// This is critical so baseEnum can get the class contants
    
public function __construct()
    {
        
parent::__construct(__CLASS__);
    }
}


$a = new testEnum;
$a->value testEnum::value2;

// Displays Two
echo $a->value;
?>