PHP getservbyport() Function

❮ PHP Network Reference

Example

A getservbyport() example:

<?php
$intservname = getservbyport(80, "tcp");
echo $intservname;
?>


Definition and Usage

The getservbyport() function returns the Internet service for a given port and protocol.

Syntax

getservbyport(port, protocol)

Parameter Values

Parameter Description
port Required. Specifies the port number (like 80)
protocol Required. Specifies a protocol name (like "tcp" or "udp")

Technical Details

Return Value: The Internet Service name on success
PHP Version: 4.0+

❮ PHP Network Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.