PHP 8.5.0 Beta 3 available for testing

ReflectionFunctionAbstract::getStaticVariables

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

ReflectionFunctionAbstract::getStaticVariables โ€” ่Žทๅ–้™ๆ€ๅ˜้‡

่ฏดๆ˜Ž

public ReflectionFunctionAbstract::getStaticVariables(): array

่Žทๅ–้™ๆ€ๅ˜้‡

ๅ‚ๆ•ฐ

ๆญคๅ‡ฝๆ•ฐๆฒกๆœ‰ๅ‚ๆ•ฐใ€‚

่ฟ”ๅ›žๅ€ผ

่ฟ”ๅ›žไธ€ไธช้™ๆ€ๅ˜้‡็š„ array

ๅ‚่ง

๏ผ‹ๆทปๅŠ ๅค‡ๆณจ

็”จๆˆท่ดก็Œฎ็š„ๅค‡ๆณจ 1 note

up
5
Martiros Aghajanyan ยถ
10 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() );

?>
To Top