code_junkie

PHP Constant doesn't exist: Notice

Nov 14th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. echo $non_existing_variable; // Error
  2. echo NON_EXISTING_CONSTANT; // Now also an error
  3.  
  4. if (defined('CONSTANT')) {
  5. echo CONSTANT;
  6. } else {
  7. throw new Exception('Undefined Constant.');
  8. }
  9.  
  10. class Config{
  11. const CONFIG_ONE = 42;
  12. }
  13. //will produce a fatal error
  14. if(Config::CONFIG_TWO){
  15. //...
  16. }
Add Comment
Please, Sign In to add comment