xref: /PHP-8.4/tests/lang/042.phpt (revision d30cd7d7)
1--TEST--
2Dynamic access of constants
3--FILE--
4<?php
5class A {
6    const B = 'foo';
7}
8
9$classname       =  'A';
10$wrongClassname  =  'B';
11
12echo $classname::B."\n";
13echo $wrongClassname::B."\n";
14?>
15===DONE===
16--EXPECTF--
17foo
18
19Fatal error: Uncaught Error: Class "B" not found in %s:%d
20Stack trace:
21#0 {main}
22  thrown in %s042.php on line %d
23