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

60 linhas
867 B
PHP

<?php
// Copyright 2004-present Facebook. All Rights Reserved.
echo "Starting\n";
// tests FPushFuncD
function hello() {
echo "hello";
return 1;
}
// tests FPushFunc
function doCall($f) {
echo "doCall(";
if ($f()) {
echo ") -- doCall got true\n";
} else {
echo ") -- doCall got false\n";
}
}
class C {
public function method1() {
$x = 1;
echo "method1\n";
if ($x) {
doCall("hello");
return hello();
}
return 0;
}
public function doPr($x) {
echo $x;
echo "\n";
if ($x) {
return 1;
}
return 2;
}
public function foo() {
echo "foo\n";
if ($this->method1()) {
if ($this->doPr(true)) {
if ($this->doPr(49)) {
return 1;
}
}
return 1;
}
return 2;
}
}
$c = new C;
$val = $c->foo();
echo $val;
echo "\n";
echo "Done\n";