$property_values) { if (is_array($property_values) && !empty($property_values)) { $this->{$property_name} = $this->objectThis($property_values); } else if (is_array($property_values) && empty($property_values)) { $this->{$property_name} = new stdClass(); } } } else { $object = new stdClass(); foreach ($array as $index => $values) { if (is_array($values) && empty($values)) { $object->{$index} = new stdClass(); } else if (is_array($values)) { $object->{$index} = $this->objectThis($values); } else { $object->{$index} = $values; } } return $object; } } ?> public function objectThis($array = null) { if (!$array) { foreach ($this as $property_name => $property_values) { if (is_array($property_values) && !empty($property_values)) { $this->{$property_name} = $this->objectThis($property_values); } else if (is_array($property_values) && empty($property_values)) { $this->{$property_name} = new stdClass(); } } } else { $object = new stdClass(); foreach ($array as $index => $values) { if (is_array($values) && empty($values)) { $object->{$index} = new stdClass(); } else if (is_array($values)) { $object->{$index} = $this->objectThis($values); } else { $object->{$index} = $values; } } return $object; } } public function objectThis($object = null) { if (!$object) { foreach ($this as $property_name => $property_values) { if (is_array($property_values)) { $this->{$property_name} = $this->objectThis($property_values); } } } else { $object2 = new stdClass(); foreach ($object as $index => $values) { if (is_array($values)) { $object2->{$index} = $this->objectThis($values); } else { $object2->{$index} = $values; } } return $object2; } }