I want to create an error register for my PHP program using a bit register

34 Views Asked by At

Has anyone tried doing this? It is quite common in my work with PLCs but I have yet to use it in php.

The idea is to use a binary number as a register for various errors so that they are collected easily. The idea would be something like

<?php 
if(isset($errorcode)){
if(getrightmostbit($errorcode) = 1){
echo "error 1";
}
$errocode << 1;
if(getrightmostbit($errorcode) = 1){
echo "error 2";
}
$errocode << 1;
if(getrightmostbit($errorcode) = 1){

echo "error 3";
}

Any thoughts?

I would ideally then like to use this register as a condition.

0

There are 0 best solutions below