<?php
class A
{
static public function doSomething()
{
var_dump(get_called_class());
}
}
class B extends A
{
static public function doSomething($a, $b)
{
parent::doSomething();
var_dump(func_get_args());
}
}
A::doSomething('1', '2');
B::doSomething('1', '2');
Fatal error: Declaration of B::doSomething($a, $b) must be compatible with A::doSomething() in /in/ZMveM on line 13
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::doSomething($a, $b) should be compatible with A::doSomething() in /in/ZMveM on line 13
string(1) "A"
string(1) "B"
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
Warning: Declaration of B::doSomething($a, $b) should be compatible with A::doSomething() in /in/ZMveM on line 18
string(1) "A"
string(1) "B"
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
Strict Standards: Declaration of B::doSomething() should be compatible with A::doSomething() in /in/ZMveM on line 18
string(1) "A"
string(1) "B"
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
Output for 5.3.0 - 5.3.29
Strict Standards: Declaration of B::doSomething() should be compatible with that of A::doSomething() in /in/ZMveM on line 18
string(1) "A"
string(1) "B"
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
}
Strict Standards: Declaration of B::doSomething() should be compatible with that of A::doSomething() in /in/ZMveM on line 18
Fatal error: Call to undefined function get_called_class() in /in/ZMveM on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ZMveM on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ZMveM on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/ZMveM on line 5
Process exited with code 255.