Using getservbyname() : getservbyname « Date « PHP






Using getservbyname()

 
<?php
    $service = "ftp";
    $port = getservbyname($service, 'tcp');
    if($port === false) {

        die("Lookup of service '$service' failed.\n");
    } else {
        echo "Service '$service' runs on port $port\n";
    }
?>
  
  








Related examples in the same category

1.getservbyname.php