1--TEST-- 2ZE2 class constants and scope 3--FILE-- 4<?php 5 6class ErrorCodes { 7 const FATAL = "Fatal error\n"; 8 const WARNING = "Warning\n"; 9 const INFO = "Informational message\n"; 10 11 static function print_fatal_error_codes() { 12 echo "FATAL = " . FATAL . "\n"; 13 echo "self::FATAL = " . self::FATAL; 14 } 15} 16 17class ErrorCodesDerived extends ErrorCodes { 18 const FATAL = "Worst error\n"; 19 static function print_fatal_error_codes() { 20 echo "self::FATAL = " . self::FATAL; 21 echo "parent::FATAL = " . parent::FATAL; 22 } 23} 24 25/* Call the static function and move into the ErrorCodes scope */ 26ErrorCodes::print_fatal_error_codes(); 27ErrorCodesDerived::print_fatal_error_codes(); 28 29?> 30--EXPECTF-- 31Warning: Use of undefined constant FATAL - assumed 'FATAL' (this will throw an Error in a future version of PHP) in %sconstants_scope_001.php on line %d 32FATAL = FATAL 33self::FATAL = Fatal error 34self::FATAL = Worst error 35parent::FATAL = Fatal error 36