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; $this->$obj->myfunc(); print_r($obj->arr);
based on WdIZg
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/fYBDF:14 Stack trace: #0 {main} thrown in /in/fYBDF on line 14
Process exited with code 255.
Output for 5.3.19 - 5.6.21
Fatal error: Using $this when not in object context in /in/fYBDF on line 14
Process exited with code 255.