Example 1 — Convert Common Protocol Numbers
Turn standard numbers into names. Results below match typical system databases.
<?php
echo getprotobynumber(6), PHP_EOL;
echo getprotobynumber(17), PHP_EOL; How It Works
- 6 is the usual number for TCP.
- 17 is the usual number for UDP.
- getprotobynumber() returns the name strings.
- Each echo prints one name per line.

