title: get combination results of 5 variables PHP
body: <p>what i have is 5 diferent inputs that user can fill or not</p>
  
  <ul>
  <li>input1:</li>
  <li>input2:</li>
  <li>input3:</li>
  <li>input4:</li>
  <li>input5:</li>
  </ul>
  
  <p>summing up each input has an state 0 or 1, not filled or filled.</p>
  
  <p>what i need to do is get all 32 combinations in a easy and short way.</p>
  
  <p>what i tried to do is something like this</p>
  
  <pre><code>i1 = trim($_POST['input1']);
  i2 = trim($_POST['input2']);
  i3 = trim($_POST['input3']);
  i4 = trim($_POST['input4']);
  i5 = trim($_POST['input5']);
  
  if(empty(i1) and empty(i2) and empty(i3) and empty(i4) and empty(i5))
  { 
       code = '00000';
       sentence = sentencesql(code); // i have a sql for each combination
  } 
  elseif (empty(i1) and empty(i2) and empty(i3) and empty(i4) and !empty(i5))
  {
       code = '00001';
       sentence = sentencesql(code);
  }
  .
  .
  .
  // each and every combination
  .
  .
  elseif(!empty(i1) and !empty(i2) and !empty(i3) and !empty(i4) and !empty(i5))
  {
       code = '11111';
       sentence = sentencesql(code);
  }
  </code></pre>
  
  <p>this works  but the code is pretty extensive </p>
  
  <p>any ideas of how to shorten the code???</p>