<?php
class ClassWithBothMagicCallMethods
{
public function __call($name, $args)
{
return "__call: " . $name;
}
public static function __callStatic($name, $args)
{
return "__callStatic: " . $name;
}
public function doSomething()
{
return static::magicCall();
}
}
class ClassWithCallStaticOnly
{
public static function __callStatic($name, $args)
{
return "__callStatic: " . $name;
}
public function doSomething()
{
return static::magicCall();
}
}
echo (new ClassWithCallStaticOnly())->doSomething() . PHP_EOL;
echo (new ClassWithBothMagicCallMethods())->doSomething() . PHP_EOL;
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/F0MEJ on line 34
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/F0MEJ on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC in /in/F0MEJ on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/F0MEJ on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/F0MEJ 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/F0MEJ on line 5
Process exited with code 255.