while($temp=key($_POST)){
$temp2=str_replace('^^','"',$$temp);
$_POST[$temp]=$temp2;
$$temp=$temp2;
next($_POST);
}
foreach ($_POST as $value) {
if($value== ""){
echo "Array is empty.";
} else {
echo "Array is NOT empty";
}
}
Their are DOZENS of examples that do what you want on the php.net page. ie the first two on the page. simple place your condition in the loops like my above examples
You may have noticed that the following are functionally identical:
<?php
$arr = array("one", "two", "three");
reset ($arr);
while (list(, $value) = each ($arr)) {
echo "Value: $value<br>\n";
}
foreach ($arr as $value) {
echo "Value: $value<br>\n";
}
?>
The following are also functionally identical:
<?php
reset ($arr);
while (list($key, $value) = each ($arr)) {
echo "Key: $key; Value: $value<br>\n";
}
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value<br>\n";
}
?>