Can you have nested classes in PHP?

class, oop, php

Solution

No.

However, you could do something like this by returning an instantiated object in getInstance():

myClass::getInstance()->foo();

Problem

I'm not talking about inheritance. And I'm not talking about nested objects. I'm talking: ``` System::Web::Templating(...) ``` kind of nesting. These are classes of which you shouldn't create instances.. so...

Original source