sharp
sharp

Reputation: 897

PHP 5.6 Singleton?

I just copied singleton template from phptherightway

I use PHP 5.6.3 (cli) And I got this error:

singleton error

Can somebody explain this ?

Upvotes: 0

Views: 462

Answers (1)

Mark Baker
Mark Baker

Reputation: 212522

It's the late static binding against a private property that's causing the problems.

Either modify the visibility of $instance to protected

Or modify the references to static::$instance in getInstance() to self::$instance

Upvotes: 1

Related Questions