<?php
function empty_values()
{
$values = func_get_args();
while (list(, $value) = each($values))
{
if (empty($value))
{
return false;
}
}
return true;
}
?>
I want to pass the values from $_POST like this
if (empty_values(implode("," , $_POST)
{
//some code
}
Use array_filter()
instead and compare the length to the length of the $_POST
array.
if (count($_POST) > count(array_filter($_POST))) {
// At least one value was empty
}