1) { $dhcpdata['DNS1'] = $arrDns[1]; } if (count($arrDns) > 2) { $dhcpdata['DNS2'] = $arrDns[2]; } } } echo json_encode($dhcpdata); }