GETPROTOBYNAME(3) 1 GETPROTOBYNAME(3)
getprotobyname - Get protocol number associated with protocol name
SYNOPSIS
int getprotobyname (string $name)
DESCRIPTION
getprotobyname(3) returns the protocol number associated with the protocol $name as per /etc/protocols.
PARAMETERS
o $name
- The protocol name.
RETURN VALUES
Returns the protocol number, or FALSE on failure.
EXAMPLES
Example #1
getprotobyname(3) example
<?php
$protocol = 'tcp';
$get_prot = getprotobyname($protocol);
if ($get_prot === FALSE) {
echo 'Invalid Protocol';
} else {
echo 'Protocol #' . $get_prot;
}
?>
SEE ALSO
getprotobynumber(3).
PHP Documentation Group GETPROTOBYNAME(3)