private function getObjectVariables($object) { if (is_object($object)) { $class = get_class($object); $methods = get_class_methods($class); if (in_array("__toString", $methods)) { return $object->__toString(); } } return ''; }