mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
25 lines
425 B
PHP
25 lines
425 B
PHP
--TEST--
|
|
ZE2 Late Static Binding creating a new class with 'static'
|
|
--FILE--
|
|
<?php
|
|
|
|
class TestClass {
|
|
public static function createInstance() {
|
|
return new static();
|
|
}
|
|
}
|
|
|
|
class ChildClass extends TestClass {}
|
|
|
|
$testClass = TestClass::createInstance();
|
|
$childClass = ChildClass::createInstance();
|
|
|
|
echo get_class($testClass) . "\n";
|
|
echo get_class($childClass) . "\n";
|
|
?>
|
|
==DONE==
|
|
--EXPECTF--
|
|
TestClass
|
|
ChildClass
|
|
==DONE==
|