I want to get the name of my child class in the base class so that whenever an object of child class is created I get the name of the child class in my base class. Something
This is certainly possible using static::class (or get_class($this) or get_called_class()) in the base class to get the name of the child (which is initially called at runtime):
Produces:
string(3) "Foo"
string(3) "Foo"
string(3) "Foo"
string(3) "Bar"
string(3) "Bar"
string(3) "Bar"
string(3) "Baz"
string(3) "Baz"
string(3) "Baz"
This is called late static binding. Here's a demo of the above.