In PHP, is it possible to have a nested class with a same name ? Tried searching a lot for these, but did not found any solution.
My Answer:
No, it is not possible to have a nested class with the same name in PHP. Each class in PHP must have a unique name within its namespace. Having nested classes with the same name would lead to ambiguity and confusion in the code. If you need to have multiple classes with the same name, you should consider using namespaces to differentiate them.
Rate this post
5 of 5 based on 1288 votesComments