parent
parent is one of the three special keywords that are used to access properties or methods from inside the class definition. It relates to the first parent class, or any or their own parents. In particular, when searching for methods or properties, it may skip the direct parent, and land on one of the parent above.
parent represents the first parent of the class, and then, recursively, all parents of that class.
parent is the supertype of the current class.
In a trait, parent represents the host class’s parent, not the trait own parent. In fact, the trait itself has no parent.
<?php
class Elephpant {
protected const HABITAT = 1;
}
class AfricanElephpant extends Elephpant {
function trumpet() {
// could also be written as \Elephpant::C; here
return parent::C;
}
}
?>