1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 00:48:25 +02:00

* Added getStaticProperty() for static methods.

This commit is contained in:
Richard Heyes
2002-04-08 21:03:41 +00:00
parent e3cc458d25
commit f006b2bbc3
+21
View File
@@ -173,6 +173,27 @@ class PEAR
}
}
// }}}
// {{{ getStaticProperty()
/**
* If you have a class that's mostly/entirely static, and you need static
* properties, you can use this method to simulate them. Eg. in your method(s)
* do this: $myVar = &PEAR::getStaticProperty('myVar');
* You MUST use a reference, or they will not persist!
*
* @access public
* @param string $class The calling classname, to prevent clashes
* @param string $var The variable to retrieve.
* @return mixed A reference to the variable. If not set it will be
* auto initialised to NULL.
*/
function &getStaticProperty($class, $var)
{
static $properties;
return $properties[$class][$var];
}
// }}}
// {{{ registerShutdownFunc()