downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<getmxrrgetprotobynumber>
Last updated: Thu, 26 Jun 2008

getprotobyname

(PHP 4, PHP 5)

getprotobyname — Get protocol number associated with protocol name

Description

int getprotobyname ( string $name )

getprotobyname() returns the protocol number associated with the protocol name as per /etc/protocols.

Parameters

name

The protocol name.

Return Values

Returns the protocol number or -1 if the protocol is not found.

Examples

Example #1 getprotobyname() example

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



add a noteadd a note User Contributed Notes
Get protocol number associated with protocol name
There are no user contributed notes for this page.




<getmxrrgetprotobynumber>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs