xref: /PHP-8.2/Zend/tests/lsb_003.phpt (revision f8d79582)
1--TEST--
2ZE2 Late Static Binding creating a new class with 'static'
3--FILE--
4<?php
5
6class TestClass {
7    public static function createInstance() {
8        return new static();
9    }
10}
11
12class ChildClass extends TestClass {}
13
14$testClass = TestClass::createInstance();
15$childClass = ChildClass::createInstance();
16
17echo get_class($testClass) . "\n";
18echo get_class($childClass) . "\n";
19?>
20--EXPECT--
21TestClass
22ChildClass
23