Arquivos
hhvm/hphp/test/vm/ClsCases.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

38 linhas
533 B
PHP

<?
class MyClass {
public static $x;
public static function foo() {
echo "in static method foo()\n";
}
};
function clsFact() {
return new MyClass();
}
// Cls :: [ String ] -> [ Class ]
MyClass::$x = 1;
// Any way to coerce the [ Obj ] -> [ Class ] variety?
$foo = new MyClass();
$varname = 'foo';
${$varname}::$x = 1;
// ClsH
$refs[] = clsFact();
$refs[] = 'MyClass';
$s = 'MyClass';
foreach($refs as $r) {
$r::foo();
}
$refs2[] = &$s;
$obj = clsFact();
$refs2[] = &$obj;
foreach($refs2 as $r) {
$r::foo();
}