Converting an object to an array will convert properties to elements of the resulting array
<?php class myclass { public $name; public $address; private $age; function SetAge($age) { $this->age = $age; } } $obj = new myclass; $obj->name = "John"; $obj->address = "Main Street"; $obj->SetAge(47); $arr = (array)$obj; print_r($arr); ?>