<?php $port = 80; $service = getservbyport($port, 'tcp'); if($service === false) { die("Could not find a service running on $port\n"); } else { echo "The '$service' service runs on port $port\n"; } ?>