Bitwise operator question

From: Date: Mon, 03 Mar 2003 19:29:34 +0000
Subject: Bitwise operator question
Groups: php.general 
Request: Send a blank email to php-general+get-137952@lists.php.net to get a copy of this message
Hi, I'm reading the description of Bitwise Operators on page 81 of "Professional PHP 4", the Wrox book. In the highlighted example on that page, the line of code... $user_permissions = CREATE_RECORDS | ALTER_RECORDS; the description in the book says that this line is building a set of user permissions out of the previously created constants with the OR operator (I understand what OR means). The value of $user_permissions is set to either 1 or 4, which is in fact 5 (0101). But how is this single line doing that? The explanation was cryptic (to me).

« previous php.general (#137952) next »