Hello,
I currently have a script that simply runs dns_get_record against a domain which the user enters through a GET, however at the current time to display the information I am running through a large amount of if(isset()) statements so it only echo's if it's actually there.
I have looked at using for each however, I seem to be unable to achieve it myself due to the slight complexity of the array.
$domain = filter_input(INPUT_GET, 'domain', FILTER_SANITIZE_URL);
$result = dns_get_record($domain);
echo $result['0']['host']."\n\n";
if (isset($result['0'])) {
echo $result['0']['type']." - ".$result['0']['target']." (TTL:".$result['0']['ttl'].")\n";
}
if (isset($result['1'])) {
echo $result['1']['type']." - ".$result['1']['target']." (TTL:".$result['1']['ttl'].")\n";
}
As you can assume it would have to continue on in that fashion indefinitely is there an easy way to accomplish this with a for each statement and if so could you provide an example?
Sorry for the rather simple question,