$counters) { foreach ($counters AS $counter => $types) { foreach($types as $type => $data) { $array[$filter][$counter][$type] = 1; } } } echo("\n"); if (count($array)) { set_entity_attrib('device', $device['device_id'], 'juniper-firewall-mib', json_encode($array)); } unset($fws, $filter, $counters, $counter, $data); // EOF