Yet Another Singleton Class in PHP (5.3)

{[ .singleton | 1.hilite(=php=) ]}

Example

{[ .example | 1.hilite(=php=) ]}

Results

Now C holds world

Now A holds 3

Now AA holds world10

Now A holds 5

Now AA holds 5

AA() is A() ? No

Singleton::instance(‘A’) is A() ? Yes

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.