1
2<?php
3class Test
4{
5 static public function getNew()
6 {
7 return new static;
8 }
9}
10
11class Child extends Test
12{}
13
14$obj1 = new Test();
15$obj2 = new $obj1;
16var_dump($obj1 !== $obj2);
17
18$obj3 = Test::getNew();
19var_dump($obj3 instanceof Test);
20
21$obj4 = Child::getNew();
22var_dump($obj4 instanceof Child);
23?>
24
25