範例
<?php $value = getservbyport(137, "udp"); ?>
getservbyname() 的用法也相同(PHP 4, PHP 5, PHP 7, PHP 8)
getservbyport — 取得對應埠和協定的網際網路服務
getservbyport() 會根據 /etc/services 傳回與指定 protocol 的 port 相關聯的網際網路服務。
port埠號。
protocol
protocol 為 "tcp" 或 "udp"(小寫)。
傳回網際網路服務名稱字串,失敗時則傳回 false。
範例
<?php $value = getservbyport(137, "udp"); ?>
getservbyname() 的用法也相同