To check if there were any results found you have to use the empty() function. The count() function always returns a number 1 or larger.
$walk_result = snmprealwalk($machine_ip, $community, $snmpcodes['interface_names']);
if (empty($walk_result)) {
print "No network interfaces found.<br>\n";
exit(0);
}