DEV Community

mhsohag11
mhsohag11

Posted on

Answer: How do i check if all keys in an array have empty values in PHP?

Assuming you actually mean an array like

array('key1' => null, 'key2' => null, 'key3' => null, 'key4' => null)

the answer is simply

if (!array_filter($array)) {
    // all values are empty (where "empty" means == false)
}

Top comments (0)