3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class myclass { public $arr = array(); public function myfunc(){ $this->arr[1] = 'one'; $this->arr[2] = 'two'; } } $obj = new myclass; myclass::myfunc(); print_r($obj->arr);
based on rFh4r
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method myclass::myfunc() should not be called statically in /in/WdIZg on line 14 Fatal error: Uncaught Error: Using $this when not in object context in /in/WdIZg:8 Stack trace: #0 /in/WdIZg(14): myclass::myfunc() #1 {main} thrown in /in/WdIZg on line 8
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Strict Standards: Non-static method myclass::myfunc() should not be called statically in /in/WdIZg on line 14 Fatal error: Using $this when not in object context in /in/WdIZg on line 8
Process exited with code 255.