title: How to implement a bitmask in php?
body: <p>I'm not sure if bitmask is the correct term. Let me explain:</p>
  
  <p>In php, the <code>error_reporting</code> function can be called multiple ways:</p>
  
  <pre><code>// Report simple running errors
  error_reporting(E_ERROR | E_WARNING | E_PARSE);
  
  // Reporting E_NOTICE can be good too (to report uninitialized
  // variables or catch variable name misspellings ...)
  error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
  
  // Report all errors except E_NOTICE
  // This is the default value set in php.ini
  error_reporting(E_ALL ^ E_NOTICE);
  </code></pre>
  
  <p>I got the term bitmask from the php.net page <a href="http://php.net/manual/en/function.error-reporting.php">here</a></p>
  
  <p>Anyway the point of this is, I have implemented a SIMPLE method called <code>ls</code> which returns the contents of a directory.</p>
  
  <p>This function takes 3 args... ( $include_hidden = false, $return_absolute = false, $ext = false )</p>
  
  <p>So when i call the function, i set how i want the results. Whether i want the results to return hidden directories, whether i want basenames only etc.</p>
  
  <p>so when i call the function i'm writing </p>
  
  <pre><code>ls(true, false, true)
  ls(false, false, true)
  ls(true, true, true)
  etc...
  </code></pre>
  
  <p>I thought it would be much more readable if i could just flag how i want the data returned?</p>
  
  <p>so something like:</p>
  
  <pre><code>ls( INCLUDE_HIDDEN | HIDE_EXTS );
  ls( SHOW_ABSOLUTE_PATHS | HIDE_EXTS );
  </code></pre>
  
  <p>etc...</p>
  
  <p>How would i implement this in terms of testing which flags have been called?</p>