nekoos-pood / bitwise-flag
Utility for handling bitwise operations | Utilidad para el manejo de operaciones bit a bit
Installs: 1 797
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-01-29 06:02:15 UTC
README
Install
composer require nekoos-pood/bitwise-flag
Usage
set
Flag up bit
in current flag set
$flag = E_NOTICE; BitwiseFlag::set($flags, E_RECOVERABLE_ERROR, true); # $flag = E_NOTICE | E_RECOVERABLE_ERROR;
Flag down bit
in current flag set
$flag = E_ALL; BitwiseFlag::set($flags, E_NOTICE, false); # $flag = E_ALL & ~E_NOTICE;
match
Check in the current set of flags
if it is up bit
$flag = E_ALL & ~E_NOTICE; $check1 = BitwiseFlag::match($flags, E_RECOVERABLE_ERROR); $check2 = BitwiseFlag::match($flags, E_NOTICE); # $check1 = true; # $check2 = false;