function all_host_risk() { Get all host $hosts = get_hosts(); Check if there is host or not if (empty($hosts)) { return false; } $result = array(); foreach ($hosts as $host) { $host_name = get_host_name($host['id']); $risk = return_last_risk_agent($host['id']); $aux = array(); $aux['name'] = $host_name; $aux['data'] = $risk; array_push($result, $aux); } return $result; }