mirror of
https://github.com/php/php-src.git
synced 2024-10-17 06:22:53 +00:00
25 lines
425 B
Plaintext
25 lines
425 B
Plaintext
|
--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==
|