Lets say I\'m building a base class which will be extended upon by the children class. So a base class is called Base and children can be Child1, <
Edit: Didn't know about get_class, disregard this one ;)
You could try __CLASS__ but it might not work properly.
A work-around could be to specify the class name as a property of the base class.
Edit: This does not work (I used the following code) construct() { echo __CLASS; } }
class b extends a {}
$b = new b;
I would suggest passing the name of $b as a parameter to A, for example:
name;
}
}
class b extends a {
protected $name = __CLASS__;
}
$b = new b;