Better example for #52499

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@302257 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Egeberg 2010-08-15 07:34:23 +00:00
parent 966294f125
commit de537ccab1

View file

@ -188,25 +188,33 @@ object(SimpleClass)#1 (1) {
<?php
class Test
{
public function getNew()
static public function getNew()
{
return new static;
}
}
$obj1 = new Test();
$obj2 = $obj1->getNew();
$obj3 = new $obj2;
class Child extends Test
{}
var_dump($obj1 === $obj2, $obj2 === $obj3);
$obj1 = new Test();
$obj2 = new $obj1;
var_dump($obj1 !== $obj2);
$obj3 = Test::getNew();
var_dump($obj3 instanceof Test);
$obj4 = Child::getNew();
var_dump($obj4 instanceof Child);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
]]>
</screen>
</example>