Hi, i would like to point out difference between self::CONST and $this::CONST with extended class.
Let us have class a:
<?php
class a {
const CONST_INT = 10;
public function getSelf(){
return self::CONST_INT;
}
public function getThis(){
return $this::CONST_INT;
}
}
?>
And class b (which extends a)
<?php
class b extends a {
const CONST_INT = 20;
public function getSelf(){
return parent::getSelf();
}
public function getThis(){
return parent::getThis();
}
}
?>
Both classes have same named constant CONST_INT.
When child call method in parent class, there is different output between self and $this usage.
<?php
$b = new b();
print_r($b->getSelf()); print_r($b->getThis()); ?>