3v4l.org

run code in 200+ php & hhvm versions
<?php class myclass { public $arr = array(); public function myfunc(){ $this->arr[1] = 'one'; $this->arr[2] = 'two'; } } $obj = new myclass; var_dump($obj);
based on abv0R
Output for 5.3.19 - 5.6.38, hhvm-3.10.1 - 3.22.0, 7.0.0 - 7.2.12
object(myclass)#1 (1) { ["arr"]=> array(0) { } }