<?php class ArrayableObject { public function toArray() { return get_object_vars($this); } } class Person extends ArrayableObject { private $name = 'delboy1978uk'; private $age = 40; protected $foo = 'bar'; } $p = new Person; var_dump($p->toArray());
You have javascript disabled. You will not be able to edit any code.