php-src/tests/lang/bug21669.phpt
2003-06-16 12:26:07 +00:00

24 lines
358 B
PHP

--TEST--
Bug #21669 "$obj = new $this->var;" doesn't work
--FILE--
<?php
class Test {
function say_hello() {
echo "Hello world";
}
}
class Factory {
var $name = "Test";
function create() {
$obj = new $this->name; /* Parse error */
return $obj;
}
}
$factory = new Factory;
$test = $factory->create();
$test->say_hello();
?>
--EXPECT--
Hello world