cvs: phpdoc /en/reference/network/functions getprotobyname.xml

From: Date: Sat, 16 Aug 2003 16:25:33 +0000
Subject: cvs: phpdoc /en/reference/network/functions getprotobyname.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969355837@lists.php.net to get a copy of this message
cece Sat Aug 16 12:25:33 2003 EDT Modified files: /phpdoc/en/reference/network/functions getprotobyname.xml Log: example note - incorporated Index: phpdoc/en/reference/network/functions/getprotobyname.xml diff -u phpdoc/en/reference/network/functions/getprotobyname.xml:1.2 phpdoc/en/reference/network/functions/getprotobyname.xml:1.3 --- phpdoc/en/reference/network/functions/getprotobyname.xml:1.2 Wed Apr 17 02:42:04 2002 +++ phpdoc/en/reference/network/functions/getprotobyname.xml Sat Aug 16 12:25:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/network.xml, last change in rev 1.2 --> <refentry id="function.getprotobyname"> <refnamediv> @@ -18,6 +18,25 @@ <function>getprotobyname</function> returns the protocol number associated with the protocol <parameter>name</parameter> as per <filename>/etc/protocols</filename>. + </para> + <para> + <example> + <title><function>getprotobyname</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$protocol = 'tcp'; +$get_prot = getprotobyname($protocol); +if ( $get_prot == -1 ) { + // if nothing found, returns -1 + print 'Invalid Protocol'; +} else { + print 'Protocol #'.$get_prot; +} +?> +]]> + </programlisting> + </example> </para> <para> See also: <function>getprotobynumber</function>.

« previous php.doc (#969355837) next »