php-src/Zend/tests/selfParent_002.phpt

28 lines
477 B
Plaintext
Raw Normal View History

2007-06-27 14:50:21 +00:00
--TEST--
Test when constants are initialised. See also selfParent_001.phpt.
--FILE--
<?php
class A {
2020-02-03 21:52:20 +00:00
const myConst = "const in A";
const myDynConst = self::myConst;
2018-09-16 17:16:42 +00:00
2020-02-03 21:52:20 +00:00
public static function test() {
var_dump(self::myDynConst);
}
2007-06-27 14:50:21 +00:00
}
class B extends A {
2020-02-03 21:52:20 +00:00
const myConst = "const in B";
2007-06-27 14:50:21 +00:00
2020-02-03 21:52:20 +00:00
public static function test() {
var_dump(parent::myDynConst);
}
2007-06-27 14:50:21 +00:00
}
B::test();
A::test();
?>
--EXPECT--
string(10) "const in A"
string(10) "const in A"