1--TEST-- 2Class protected constant visibility 3--FILE-- 4<?php 5class A { 6 protected const protectedConst = 'protectedConst'; 7 static function staticConstDump() { 8 var_dump(self::protectedConst); 9 } 10 function constDump() { 11 var_dump(self::protectedConst); 12 } 13} 14 15A::staticConstDump(); 16(new A())->constDump(); 17try { 18 constant('A::protectedConst'); 19} catch (Error $e) { 20 echo $e->getMessage(), "\n"; 21} 22 23?> 24--EXPECT-- 25string(14) "protectedConst" 26string(14) "protectedConst" 27Cannot access protected constant A::protectedConst 28