getprotobyname

Get protocol number associated with protocol name

&reftitle.description; ``int``false```getprotobyname` `string` `protocol`

`getprotobyname` returns the protocol number associated with the protocol `protocol` as per `/etc/protocols`.

&reftitle.parameters;

`protocol`

- The protocol name.

&reftitle.returnvalues;

Returns the protocol number, &return.falseforfailure;.

&reftitle.examples;

### `getprotobyname` example

    <?php
    $protocol = 'tcp';
    $get_prot = getprotobyname($protocol);
    if ($get_prot === FALSE) {
        echo 'Invalid Protocol';
    } else {
        echo 'Protocol #' . $get_prot;
    }
    ?>

&reftitle.seealso;

- `getprotobynumber`