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:
<?php
class a {
protected $name;
public function __construct() {
echo $this->name;
}
}
class b extends a {
protected $name = __CLASS__;
}
$b = new b;