note 75982 deleted from language.oop5.constants by didou

From: Date: Mon, 09 Jul 2007 12:50:32 +0000
Subject: note 75982 deleted from language.oop5.constants by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128320@lists.php.net to get a copy of this message
Note Submitter: rlee0001 ---- For people who, for readability sake, used to create "flag" constants like so: <?php define("MYLIB_SHOW_HEADER", 1 << 0); define("MYLIB_SHOW_FOOTER", 1 << 1); define("MYLIB_SHOW_ALL", MYLIB_SHOW_HEADER | MYLIB_SHOW_FOOTER); ... ?> The equiv with class constants must instead read: <?php MyLib class { SHOW_HEADER = 1; SHOW_FOOTER = 2; SHOW_ALL = 3; ... } ?> Which gets very unreadable very quickly when lots of flags are involved (e.g. SHOW_ALL must be created and maintained manually).

« previous php.notes (#128320) next »