Arquivos
hhvm/hphp/test/vm/static_vars.php
T
Jordan Delong 363d1bb20f Code move src/ -> hphp/
This change is mostly for FB internal organizational reasons.
Building is not effected beyond the fact that the target now
lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
2013-02-11 02:10:41 -08:00

44 linhas
455 B
PHP

<?php
function foo() {
static $a;
$a++;
print "foo $a\n";
}
function bar() {
static $a;
$a += 2;
print "bar $a\n";
}
class A {
private function priv() {
static $x = 0;
$x += 4;
print "A::priv $x\n";
}
function baz() {
static $a;
$a += 4;
print "A::baz $a\n";
$this->priv();
}
}
class B extends A {
}
$a = new A();
$b = new B();
foo();
bar();
$a->baz();
$b->baz();
foo();
bar();
$a->baz();
$b->baz();