PHP | getprotobyname() Function Last Updated : 03 Sep, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The getprotobyname() function is an inbuilt function in PHP which returns the protocol number for a specified protocol name. Syntax: int getprotobyname( string $name ) Parameters: This function accepts single parameter $name which is required. It specifies the protocol name, like tcp, icmp, udp, ip etc. Return Value: This function returns the protocol number on success and FALSE on failure. Note: This function is available for PHP 4.0.0 and newer version. Below programs illustrate the getprotobyname() function in PHP: Program 1: This program gets the protocol number for protocol name "tcp". php <?php // Use getprotobyname() function to // get the protocol number $protocolnum = getprotobyname("tcp"); // Display the result echo $protocolnum; ?> Output: 6 Program 2: This program checking the many protocols name. php <?php $protocols = array("tcp", "udp", "hmp", "ipv6"); foreach( $protocols as $protocol ){ // Use getprotobyname() function to // get the protocol number $protocol_name = getprotobyname($protocol); // Display the result echo $protocol_name . ": " . $protocol . "<br>"; } ?> Output: 6: tcp 17: udp 20: hmp 41: ipv6 Reference: https://www.php.net/manual/en/function.getprotobyname.php Comment More infoAdvertise with us Next Article PHP | gethostbyname() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | getprotobynumber() Function The getprotobynumber() function is an inbuilt function in PHP which returns the protocol name for a specified protocol number. Syntax: string getprotobynumber( int $protocol_number ) Parameters: This function accepts single parameter $protocol_number which is required. It specifies the protocol numb 1 min read PHP | gethostbyname() Function The gethostbyname() function is an inbuilt function in PHP which returns IPv4 address for a specified host/domain name. Syntax: string gethostbyname( $hostname ) Parameter: This function accepts single parameter $hostname which is required. It specifies the hostname whose IPv4 address to be found. R 1 min read PHP | gethostname() Function The gethostname() function is an inbuilt function in PHP which returns the host or domain name for the local machine. This function is applicable after PHP 5.3.0 before that there was another function called php_uname function. Syntax: string gethostname( void ) Parameters: This function doesn't acc 1 min read PHP | gethostnamel() Function The gethostbynamel() function is an inbuilt function in PHP which returns a list of IPv4 address for a specified internet host/domain name. Syntax: gethostbynamel( string $hostname ) Parameters: This function accepts single parameter $hostname which is required. It specifies the hostname whose IPv4 1 min read PHP | IntlChar getPropertyName() Function The IntlChar::getPropertyName() function is an inbuilt function in PHP which is used to get the Unicode name for a given property which is given in the Unicode database file PropertyAliases.txt. This function maps the property IntlChar::PROPERTY_GENERAL_CATEGORY_MASK to the synthetic names "gcm" / " 2 min read PHP | Reflection getShortName() Function The Reflection::getShortName() function is an inbuilt function in PHP which is used to return the short name of the specified class, the part without the namespace. Syntax: string Reflection::getShortName( void ) Parameters: This function does not accept any parameters. Return Value: This function r 1 min read Like