KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to declare an instance of a class as a property in PHP? Basically what I want to achieve is: abstract class ClassA() { static $property = new ClassB(); } Well, I know I can't do that, but is there any workaround beside always doing something like this: if (!isset(ClassA::$property)) ClassA::$property = new ClassB();
Tags (comma-separated)
Save Edits
Cancel