<?php
class myclass
{
public $arr = array();
public function myfunc(){
$this->arr[1] = 'one';
$this->arr[2] = 'two';
}
}
$obj = new myclass;
$this->myfunc();
print_r($obj->arr);
Fatal error: Uncaught Error: Using $this when not in object context in /in/rFh4r:14
Stack trace:
#0 {main}
thrown in /in/rFh4r on line 14
Process exited with code 255.