getAccessibleRefProperty example

/** * Set a private property. * * @param object|string $obj object or class name * @param string $property property name * @param mixed $value value * * @throws ReflectionException */
    public static function setPrivateProperty($obj$property$value)
    {
        $refProperty = self::getAccessibleRefProperty($obj$property);
        $refProperty->setValue($obj$value);
    }

    /** * Retrieve a private property. * * @param object|string $obj object or class name * @param string $property property name * * @return mixed value * * @throws ReflectionException */
Home | Imprint | This part of the site doesn't use cookies.