SHARE
TWEET

PHP enum

a guest Jul 9th, 2011 551 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PageSpecial {
  2.     protected $value;
  3.     private static $instances = array();
  4.     protected function __construct($value) {
  5.         $this->value = $value;
  6.     }
  7.     function __toString() {
  8.         return $this->value;
  9.     }
  10.     static function conditions() {
  11.         if (!isset($instances[__FUNCTION__])) {
  12.             $instances[__FUNCTION__] = new self(__FUNCTION__);
  13.         }
  14.         return $instances[__FUNCTION__];
  15.     }
  16.     static function home() {
  17.         if (!isset($instances[__FUNCTION__])) {
  18.             $instances[__FUNCTION__] = new self(__FUNCTION__);
  19.         }
  20.         return $instances[__FUNCTION__];
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top