Oihana PHP

setFlag.php

Table of Contents

Functions

setFlag()  : int
Sets a specific flag in a bitmask.

Functions

setFlag()

Sets a specific flag in a bitmask.

setFlag(int $mask, int $flag) : int
Parameters
$mask : int

The original bitmask.

$flag : int

The flag to set.

Tags
example
use function oihana\core\bits\setFlag;

const FLAG_A = 1 << 0; // 1
const FLAG_B = 1 << 1; // 2

$mask = FLAG_A;          // 1
$mask = setFlag( $mask  , FLAG_B ) ;
// $mask is now 3 (FLAG_A | FLAG_B)
author

Marc Alcaraz (ekameleon)

since
1.0.7
Return values
int

The new bitmask with the flag set.


        
On this page

Search results