xref: /PHP-8.1/Zend/tests/selfParent_002.phpt (revision f8d79582)
1--TEST--
2Test when constants are initialised. See also selfParent_001.phpt.
3--FILE--
4<?php
5class A {
6    const myConst = "const in A";
7    const myDynConst = self::myConst;
8
9    public static function test() {
10        var_dump(self::myDynConst);
11    }
12}
13
14class B extends A {
15    const myConst = "const in B";
16
17    public static function test() {
18        var_dump(parent::myDynConst);
19    }
20}
21
22B::test();
23A::test();
24?>
25--EXPECT--
26string(10) "const in A"
27string(10) "const in A"
28