Here is a little trick you can use to simulate static variables within a PHP class. PHP5 does not yet support static variables, though it does have support for static class functions.
$GLOBALS['_transient']['static']['test']->v1 = 1;
class Test {
function Test() {
$this->v1 = & $GLOBALS['_transient']['static']['test']->v1;
}
function printAndIncrease() {
echo "$this->v1<br>";
$this->v1++;
}
var $v1;
}
$t1 = new Test();
$t1->printAndIncrease();
$t2 = new Test();