<?php
abstract class Base
{
protected function __construct(){}
public function create(){
return new self();
}
abstract function action();
}
class Item extends Base{
public function action(){ echo __CLASS__; }
}
$item = Item::create();
$item->action();
Fatal error: Uncaught Error: Non-static method Base::create() cannot be called statically in /in/6AIqF:16
Stack trace:
#0 {main}
thrown in /in/6AIqF on line 16
Process exited with code 255.
Deprecated: Non-static method Base::create() should not be called statically in /in/6AIqF on line 16
Fatal error: Uncaught Error: Cannot instantiate abstract class Base in /in/6AIqF:7
Stack trace:
#0 /in/6AIqF(16): Base::create()
#1 {main}
thrown in /in/6AIqF on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Cannot instantiate abstract class Base in /in/6AIqF:7
Stack trace:
#0 /in/6AIqF(16): Base::create()
#1 {main}
thrown in /in/6AIqF on line 7
Process exited with code 255.
Strict Standards: Non-static method Base::create() should not be called statically in /in/6AIqF on line 16
Fatal error: Cannot instantiate abstract class Base in /in/6AIqF on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/6AIqF on line 3
Process exited with code 255.