Why check if value of an array is an array?
<p>I came across the following code in the book PHP Solutions, 2nd Edition</p>

<pre><code>&lt;?php
foreach ($_POST as $key =&gt; $value) {
    // assign to temporary variable and strip whitespace if not an array
    $temp = is_array($value) ? $value : trim($value);
    // if empty and required, add to $missing array
    if (empty($temp) &amp;&amp; in_array($key, $required)) {
        $missing[] = $key;
    } if (in_array($key, $expected)) {
        // otherwise, assign to a variable of the same name as $key
        ${$key} = $temp;
    }
}
?&gt;
</code></pre>

<p>My question is in regards to this line:</p>

<p><code>$temp = is_array($value) ? $value : trim($value);</code></p>

<p>If $value is the value held in the array (user inputted content from a form), why is it critical to determine whether or not the value is an array?  Is it for security?</p>
