3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait Evil { public $info = ['data', 'I', 'want', 'to', 'add', 'to']; public function getInfo() { return $this->info; } } class Human { use Evil; public function getInfo() { $data = Evil::getInfo(); return $data + ['and', 'I', 'think', 'I', 'did']; } } var_dump((new Human)->getInfo());
based on CT8sl
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method Evil::getInfo() should not be called statically in /in/7IEoC on line 12 Fatal error: Uncaught Error: Using $this when not in object context in /in/7IEoC:5 Stack trace: #0 /in/7IEoC(12): Evil::getInfo() #1 /in/7IEoC(18): Human->getInfo() #2 {main} thrown in /in/7IEoC on line 5
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Deprecated: Non-static method Evil::getInfo() should not be called statically, assuming $this from incompatible context in /in/7IEoC on line 12 array(6) { [0]=> string(4) "data" [1]=> string(1) "I" [2]=> string(4) "want" [3]=> string(2) "to" [4]=> string(3) "add" [5]=> string(2) "to" }
Output for 5.4.0 - 5.5.35
Strict Standards: Non-static method Evil::getInfo() should not be called statically, assuming $this from incompatible context in /in/7IEoC on line 12 array(6) { [0]=> string(4) "data" [1]=> string(1) "I" [2]=> string(4) "want" [3]=> string(2) "to" [4]=> string(3) "add" [5]=> string(2) "to" }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/7IEoC on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/7IEoC on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/7IEoC on line 3
Process exited with code 255.