PHP,Bitwise运算符和使用包含或作为启用选项的参数

Is there a way of defining some variables with true or false and passing them in collectively into a function as a parameter like in C++ like flags to turn sections of a function on or off using the bitwise inclusive or... For example:

// Declare

define( "ADMIN", TRUE);
define( "CLIENT", TRUE);

function Authenticated( $flags )
{
    // Not sure what would go here ? but something like
    // If ADMIN then
    // If CLIENT then
    // If ADMIN | CLIENT then
}

// Call

Authenticated( ADMIN | CLIENT );

You can define constants in your class and make sure their values are separate bits:

class Authentication
{
    const ADMIN  = 0x0001;
    const CLIENT = 0x0002;
}

function Authenticated($flags)
{
    $adminFlag = $flags & Authentication::ADMIN;
    $clientFlag = $flags & Authentication::CLIENT;

    if ($adminFlag && $clientFlag) ...
    else if ($adminFlag) ...
    else if ($clientFlag) ...
}
define("ADMIN", 0x0001);
define("CLIENT", 0x0002);

And now you can use them as actual bitflags.