protected function getMembers($object)
    {
        $reflection = new ReflectionObject($object);
        $members    = array();
        foreach ($reflection->getProperties() as $property) {
            if (method_exists($property, 'setAccessible')) {
                $property->setAccessible(true);
            }
            try {
                $members[$property->getName()] = $property->getValue($object);
            } catch (ReflectionException $e) {
                $members[$property->getName()] =
                    $this->getPrivatePropertyNoMatterWhat($property->getName(), $object);
            }
        }

        return $members;
    }
protected function getMembers($object)
    {
        $reflection = new ReflectionObject($object);
        $members    = array();
        foreach ($reflection->getProperties() as $property) {
            if (method_exists($property, 'setAccessible')) {
                $property->setAccessible(true);
            }
            try {
                $members[$property->getName()] = $property->getValue($object);
            } catch (ReflectionException $e) {
                $members[$property->getName()] =
                    $this->getPrivatePropertyNoMatterWhat($property->getName(), $object);
            }
        }

        return $members;
    }
protected function getMembers ( $ object ) { $ reflection = new ReflectionObject ( $ object ) ; $ members = array ( ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { if ( method_exists ( $ property , 'setAccessible' ) ) { $ property -> setAccessible ( true ) ; } try { $ members [ $ property -> getName ( ) ] = $ property -> getValue ( $ object ) ; } catch ( ReflectionException $ e ) { $ members [ $ property -> getName ( ) ] = $ this -> getPrivatePropertyNoMatterWhat ( $ property -> getName ( ) , $ object ) ; } } return $ members ; }
Get all members of an object including private and protected ones.
A safer form of casting to an array.

@param object $object     Object to list members of, including private ones.

@return array             Names and values in the object.
Get all members of an object including private and protected ones . A safer form of casting to an array .