getprotobyname
getprotobyname
Get protocol number associated with protocol name
**getprotobyname** string $protocol
returns the protocol number
associated with the protocol as per
.
getprotobyname``protocol
protocolThe protocol name.
Returns the protocol number, return.falseforfailure.
Voorbeeld: example
<?php
$protocol = 'tcp';
$get_prot = getprotobyname($protocol);
if ($get_prot === FALSE) {
echo 'Invalid Protocol';
} else {
echo 'Protocol #' . $get_prot;
}
?>
getprotobynumber