array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.getprotobyname.php', 1 => 'getprotobyname', ), 'up' => array ( 0 => 'ref.network.php', 1 => 'Netzwerk-Funktionen', ), 'prev' => array ( 0 => 'function.getmxrr.php', 1 => 'getmxrr', ), 'next' => array ( 0 => 'function.getprotobynumber.php', 1 => 'getprotobynumber', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'de', '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 — Liefert die Protokollnummer anhand des Protokollnamens
Die Funktion getprotobyname() gibt die Protokollnummer
passend zu dem Protokoll protocol
zurück. Der Wert
wird anhand der Datei /etc/protocols ermittelt.
protocol
Der Protokollname.
Gibt die Protokollnummer zurück. Bei einem Fehler wird false
zurückgegeben.
Beispiel #1 getprotobyname()-Beispiel
<?php
$protocol = 'tcp';
$get_prot = getprotobyname($protocol);
if ($get_prot === FALSE) {
echo 'Ungueltiges Protokoll';
} else {
echo 'Protokoll #' . $get_prot;
}
?>