PHP 7.0.6 Released

ReflectionFunctionAbstract::getStaticVariables

(PHP 5, PHP 7)

ReflectionFunctionAbstract::getStaticVariablesGets static variables

Description

public array ReflectionFunctionAbstract::getStaticVariables ( void )

Get the static variables.

Warning

This function is currently not documented; only its argument list is available.

Parameters

This function has no parameters.

Return Values

An array of static variables.

See Also

User Contributed Notes

Martiros Aghajanyan
1 year 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