Source Code:
(back to article)
<?php $service_name = "http"; $protocol_name = "tcp"; $port_number = getservbyname($service_name, $protocol_name); if ($port_number === false) { echo "Failed to retrieve port number for service name $service_name and protocol name $protocol_name"; } else { echo "The port number for service name $service_name and protocol name $protocol_name is $port_number"; }
Result:
Report an issue