1--TEST-- 2Class private constant visibility 3--FILE-- 4<?php 5class A { 6 private const privateConst = 'privateConst'; 7 static function staticConstDump() { 8 var_dump(self::privateConst); 9 } 10 function constDump() { 11 var_dump(self::privateConst); 12 } 13} 14 15A::staticConstDump(); 16(new A())->constDump(); 17constant('A::privateConst'); 18 19?> 20--EXPECTF-- 21string(12) "privateConst" 22string(12) "privateConst" 23 24Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14 25Stack trace: 26#0 %s(14): constant('A::privateConst') 27#1 {main} 28 thrown in %s on line 14 29