PhpSandbox\PHPSandbox::defineSuperglobal PHP Méthode

defineSuperglobal() public méthode

You can pass the superglobal $name and $value to define, or an associative array of superglobals to define, or a third variable to define the $key
public defineSuperglobal ( string | array $name, mixed $value )
$name string | array String of superglobal $name or associative array of superglobal names to define
$value mixed Value to define superglobal to, can be callable
    public function defineSuperglobal($name, $value)
    {
        if (is_array($name)) {
            return $this->defineSuperglobals($name);
        }
        if (!$name) {
            $this->validationError("Cannot define unnamed superglobal!", Error::DEFINE_SUPERGLOBAL_ERROR, null, '');
        }
        $name = $this->normalizeSuperglobal($name);
        if (func_num_args() > 2) {
            $key = $value;
            $value = func_get_arg(2);
            $this->definitions['superglobals'][$name][$key] = $value;
        } else {
            $this->definitions['superglobals'][$name] = $value;
        }
        return $this;
    }
PHPSandbox