(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::getStaticVariables — Obtiene las variables estáticas
Obtiene las variables estáticas.
Esta función no contiene ningún parámetro.
Un array de variables estáticas.
<?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() );
?>