php8.5
Home/ Manual/ uopz / functions/ uopz_set_static

uopz_set_static

PHP function Edit on GitHub ✎

(PECL uopz 5, PECL uopz , PECL uopz 7)

Sets the static variables in function or method scope

Description

uopz_set_static(string $function, array $static): void
uopz_set_static(string $class, string $function, array $static): void

Sets the static variables in function or method scope.

Parameters

class

The name of the class.

function

The name of the function or method.

static

The associative array of variable names mapped to their values.

Return Values

Void

Examples

Basic uopz_set_static() Usage

php
<?php
function foo() {
    static $bar = 'baz';
    var_dump($bar);
}
uopz_set_static('foo', ['bar' => 'qux']);
foo();
?>

The above example will output:

output
string(3) "qux"

See Also

Source: reference/uopz/functions/uopz_set_static.xml · from the official PHP manual (php/doc-en)