sharp
sharp

Reputation: 887

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: 461

Answers (1)

Mark Baker
Mark Baker

Reputation: 212412

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