Re: Reusable Singleton pattern using PHP5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> php6 will include static late binding
Great. Love the other new features, especially namespaces.
> - until then you have 2 choices,> create a hack (see below) or stick redundant code into each class you> want to be a singleton.
The hack doesn't work (See below). Guess we are left with copy-pastething :-/ Though i wonder if there are any other hacks using some sortof classkit/other class manipulation functions?
>     public static function GetInstance()>     {>         if (!isset(self::$instance)) {>                 if (!isset(self::$class)) {
Isn't that self::$class the same "late static binding" thing? :-) As iget it, at this point from Singleton::GetInstance() you can't get thestatic $class member of Test class.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux