« uopz_set_return
uopz_undefine »

uopz_set_static

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

uopz_set_static — Sets the static variables in function or method scope

説明

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

Sets the static variables in function or method scope.

パラメータ

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.

戻り値

値を返しません。

例

例1 Basic uopz_set_static() Usage

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

上の例の出力は以下となります。

string(3) "qux"

参考

  • uopz_get_static() - 関数またはメソッドスコープから、static変数を取得する
関連キーワード:
static   uopz   method   Sets   variables   scope   return   undefine   Uopz   associative   variable   names   mapped   their   values   Usage   dump   参考   スコープ   変数
関連する関数・ページ:
function.uopz-get-static   function.uopz-add-function   function.uopz-get-return   function.uopz-del-function   uopz.configuration   function.uopz-undefine