check array against each other, to determine response
<p>So, I have an array that has 6 variables in it that I need to check against each other..  to determine what to return to the script calling the function..  All fields are of the <code>datetime</code>  type from the database they are derived from.</p>

<p>the fields: <code>in1</code> <code>out1</code> <code>in2</code> <code>out2</code> <code>in3</code> <code>out3</code></p>

<p>Array:</p>

<pre><code>Array(
  'in1' =&gt; '2012-04-02 10:00:00), 
  `out1` =&gt; '2012-04-02 14:00:00`,
  `in2` =&gt; '2012-04-02 14:30:00`,
  `out2` =&gt; '2012-04-02 18:00:00`,
  `in3` =&gt; NULL,
  `out3` =&gt; NULL
)
</code></pre>

<p>the response:</p>

<p><code>clocked_in</code> or <code>clocked_out</code></p>

<p>What I need to figure out is, the best way to determine if the user is clocked in or clocked out by checking against this array..</p>

<p>so, if <code>in1</code>, <code>out1</code> and <code>in2</code> are not NULL then the user would be clocked in..  if <code>in1</code> is not NULL but <code>out1</code> is NULL then the user would be clocked out, etc..  Anyone have any ideas on the easiest way to achieve this without too many if statements?</p>

<p>[WHAT WORKED]</p>

<pre><code>for ($i=1; $i &lt;= 3; $i++) {
    if ($entities["in$i"] != NULL) {
        $ents = "clocked_in";
        if ($entities["out$i"] != NULL) {
            $ents = "clocked_out";
        }
        if ($entities["out3"] != NULL) {
            $ents = "day_done";
        }
    }
}
</code></pre>
