Tag Archives: Overloading

PHP Programming with E_STRICT beware!

I recently switched to programming PHP with error_reporting set to E_STRICT, since I want to know what’s going on. You have to watch out when extending classes and trying to overrule the parameters of the child method. An example:

php-e-strict-errors

When executing you will get the following error “Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /path/to/file/test.php on line 18

When I remove the parameter ‘value’ from the method ‘test’ in the class ‘B’, everything’s fine. Write that down.