I do not understand the concept of calling a parent method in PHP. The parent method is not static, but it is called statically - usually PHP generates an error / warning.
The question is, is this a quirk from PHP, or is it how it should be in OOP?
Taking an example from php.net:
<?php
class A {
function example() {
echo "I am A::example() and provide basic functionality.<br />\n";
}
}
class B extends A {
function example() {
echo "I am B::example() and provide additional functionality.<br />\n";
parent::example();
}
}
$b = new B;
$b->example();
?>
http://php.net/manual/en/keyword.parent.php
In PHP 5, calling non-static methods statically generates E_STRICT level warnings.
http://php.net/manual/en/language.oop5.static.php
source
share