Jump to content

Checking all values in an array


bluwe

Recommended Posts

ummm, there may be a quicker way. but here is one way:

 

$array = array("Key" => '', "Key2" => '', "Key3" => '');

$blanks = true;
foreach($array as $key => $val){
if($val != ""){
$blanks = false;
break;
}
}

if($blanks){
echo "All array values are empty!";
}

 

enjoy.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.