PHP: a foreach question from PHP Solutions book?

T-bag

New member
here is part of the code:

// process the $_POST variables
foreach ($_POST as $key => $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) && in_array($key, $required)) {
array_push($missing, $key);
}
// otherwise, assign to a variable of the same name as $key
elseif (in_array($key, $expected)) {
${$key} = $temp;
}
}

what is $temp = is_array($value) ? $value : trim($value); doing? I thought is_array($value) always evaluates to false because $value is never an array(the values are submitted in a form). Please help
 
Back
Top