Advertisement
HaLo2FrEeEk

Bit flags PHP

Jan 27th, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. <?php
  2. $progress['1'] = "partial_easy";
  3. $progress['2'] = "easy";
  4. $progress['4'] = "partial_normal";
  5. $progress['8'] = "normal";
  6. $progress['16'] = "partial_heroic";
  7. $progress['32'] = "heroic";
  8. $progress['64'] = "partial_legendary";
  9. $progress['128'] = "legendary";
  10.  
  11. $byte = '64'; // This would be from a database, stored in a TINYINT field (1 byte)
  12.  
  13. echo $progress[$byte];
  14. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement