splintercell Posted August 15, 2009 Share Posted August 15, 2009 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 Link to comment https://forums.phpfreaks.com/topic/170371-a-foreach-question-from-php-solutions/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.