PHP | getprotobynumber() Function Last Updated : 30 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 number, like 6 for tcp, 17 for udp etc. Return Value: This function returns protocol name on success and FALSE on failure. Note: This function is available for PHP 4.0.0 and newer version. Below programs illustrate the getprotobynumber() function in PHP: Program 1: This program uses protocol number for protocol name "tcp". php <?php // The getprotobynumber() function get protocol // name associated with protocol number $protocolname = getprotobynumber(6); // Display result echo $protocolname; ?> Output: tcp Program 2: This program checking for many protocol name. php <?php // Store the protocol number in an array $protocol_number = array(6, 17, 20, 41); foreach( $protocol_number as $number ){ // The getprotobynumber() function get protocol // name associated with protocol number echo $number . ": " . getprotobynumber($number) . "<br>"; } ?> Output: 6: tcp 17: udp 20: hmp 41: ipv6 Reference: https://www.php.net/manual/en/function.getprotobynumber.php Comment More infoAdvertise with us Next Article PHP | getprotobyname() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | getprotobyname() Function 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 1 min read PHP gettype() Function The PHP gettype() function returns the type of a variable as a string. It identifies the variable's data type, such as string, integer, array, boolean, etc., allowing developers to check and handle different data types dynamically.Syntax:string gettype ( $var )Parameter: This function accepts a sing 2 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 | IntlChar getPropertyValueEnum() Function The IntlChar getPropertyValueEnum() function is an inbuilt function in PHP which is used to get the property value form the given value. Syntax: int IntlChar::getPropertyValueEnum( $property, $name ) Parameters: This function accepts two parameters as mentioned above and described below: $property: 1 min read PHP | is_numeric() Function The is_numeric() function is an inbuilt function in PHP which is used to check whether a variable passed in function as a parameter is a number or a numeric string or not. The function returns a boolean value. Syntax: bool is_numeric ( $var ) Parameters: The function accepts a single parameter which 2 min read PHP | Imagick getNumberImages() Function The Imagick::getNumberImages() function is an inbuilt function in PHP which is used to get the number of images in the Imagick object. This function can also be used to count the number of frames in a GIF animation. Syntax: int Imagick::getNumberImages( void ) Parameters: This function doesnât accep 1 min read Like