So, I won't explain much, because I simply don't know how to explain it properly. Will just give you an example and ask you - is there some better way to get the same result, because I want to make this for pretty huge numbers.
PHP Code:
new num
if(Flag & Tags[1][flag]) num = 1
else if(Flag & Tags[2][flag]) num = 2
else if(Flag & Tags[3][flag]) num = 3
else if(Flag & Tags[4][flag]) num = 4
else if(Flag & Tags[5][flag]) num = 5
else if(Flag & Tags[6][flag]) num = 6
__________________