English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP getservbyport() Function Usage and Example

PHP HTTP Reference Manual

The getservbyport() function retrieves the Internet service corresponding to the port and protocol.

Syntax

string getservbyport ( int $port , string $protocol )

Definition and usage

Used to obtain the Internet service corresponding to the port number

Return value

Returns the Internet service name in string format. Returns false on failure.

Parameter

Serial numberParameters and descriptions
1

port

Port number

2

protocol

The protocol is 'tcp' or 'udp' (lowercase).

PHP HTTP Reference Manual