array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'function.getprotobyname.php', 1 => 'getprotobyname', ), 'up' => array ( 0 => 'ref.network.php', 1 => 'Fonctions réseaux', ), 'prev' => array ( 0 => 'function.getmxrr.php', 1 => 'getmxrr', ), 'next' => array ( 0 => 'function.getprotobynumber.php', 1 => 'getprotobynumber', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/network/functions/getprotobyname.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
getprotobyname — Retourne le numéro de protocole associé à un nom de protocole
getprotobyname() retourne le numéro de
protocole associé avec le nom de protocole
protocol
, comme dans /etc/protocols.
protocol
Le nom du protocole.
Retourne le numéro du protocole, ou false
si une erreur survient.
Exemple #1 Exemple avec getprotobyname()
<?php
$protocol = 'tcp';
$get_prot = getprotobyname($protocol);
if ($get_prot === FALSE) {
echo 'Protocole invalide';
} else {
echo 'Protocole #' . $get_prot;
}
?>