略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ReflectionFunctionAbstract::getStaticVariables

2024-04-26

ReflectionFunctionAbstract::getStaticVariables

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

ReflectionFunctionAbstract::getStaticVariables获取静态变量

说明

public ReflectionFunctionAbstract::getStaticVariables(): array

获取静态变量

警告

本函数还未编写文档,仅有参数列表。

参数

此函数没有参数。

返回值

返回一个静态变量的 array

add a noteadd a note

User Contributed Notes 1 note

up
4
Martiros Aghajanyan
7 years ago
<?php

function test()
{
    static
$a = 0, $b = 15;
   
$a++;
   
$b++;
    return
$a;
}

$rf = new ReflectionFunction('test');

// result - Array ( [a] => 0 [b] => 15 )
print_r( $rf->getStaticVariables() );

//call test function and print again static variables
test();

// result - Array ( [a] => 1 [b] => 16 )
print_r( $rf->getStaticVariables() );

?>

官方地址:https://www.php.net/manual/en/reflectionfunctionabstract.getstaticvariables.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3