PHP | headers_list() Function Last Updated : 31 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The header_list() function is an inbuilt function in PHP which returns the list of response header that sent or ready to send to the client or browser, in the form of array. Syntax: array headers_list( void ) Parameters: This function does not accept any parameter. Return Value: It returns a list or array of headers to be sent to the browser or client. Note: It differs from headers_sent() function which is suitable to check whether the header sent or not but headers_list() is not favorable in this context as it lists both sent and ready to send states of headers. Example 1: php <?php // Use setcookie() function to add // response header setcookie("cookie1", "value_of_cookie1"); // Define the header header("test: geeksforgeeks"); header("Content-type: text/plain"); // Display the array returned by the // headers_list() function print_r(headers_list()); ?> Output: Array ( [0] => Set-Cookie: cookie1=value_of_cookie1 [1] => test: geeksforgeeks [2] => Content-type: text/plain;charset=UTF-8 ) Example 2: php <?php // Use setcookie() function to add // header automatically setcookie('uid', 'user4059'); // Defining a custom response header header("custom-res-header: cstm"); // Specifying plain text content in // response header('Content-type: text/plain'); // Display all sent headers var_dump(headers_list()); ?> Output: array(3) { [0]=>string(24) "Set-Cookie: uid=user4059" [1]=>string(23) "custom-res-header: cstm" [2]=>string(38) "Content-type: text/plain;charset=UTF-8" } Reference: http://php.net/manual/en/function.headers-list.php Comment More infoAdvertise with us Next Article PHP | headers_list() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP ob_list_handlers() Function The ob_list_handlers() function is an inbuilt function in PHP that enumerates all output handlers currently in use. Syntax: ob_list_handlers(): arrayParameter: This function does not have any parameters. Return Values: The function will return an array containing the names of all output buffering ha 1 min read PHP | header() Function The header() function is an inbuilt function in PHP which is used to send a raw HTTP header. The HTTP functions are those functions which manipulate information sent to the client or browser by the Web server, before any other output has been sent. The PHP header() function send a HTTP header to a c 3 min read PHP list() Function The list() function is an inbuilt function in PHP which is used to assign array values to multiple variables at a time. This function will only work on numerical arrays. When the array is assigned to multiple values, then the first element in the array is assigned to the first variable, second to th 2 min read PHP | headers_sent() function The headers_sent() function is an inbuilt function in PHP which is used to determines whether the header is successfully sent or not. The headers_sent() function returns True if header sent successfully and False otherwise. Syntax: bool headers_sent( $file, $line ) Parameters: This function accepts 3 min read PHP array_is_list() Function The array_is_list() function is an inbuilt function in PHP that is used to check whether a given array is a list or not. If the given array will be a list if the key of the array contains consecutive numbers from 0 to count($arr)-1. Syntax:Â bool array_is_list(array $array) Parameters: This function 1 min read PHP | lstat( ) function The lstat() function in PHP is used to return information about a file or a symbolic link. It gathers statistics of the file which is sent as a parameter to the lstat() function. The function returns an array which includes information on following elements :Â Â [0] or [dev] - Device number[1] or [in 4 min read PHP | filter_list() Function The filter_list() function is an inbuilt function in PHP which is used to returns the list of all supported filters. Syntax: array filter_list( void ) Parameters: This function does not accepts any parameters. Return Values: It returns an array containing all names of supported filters. If it return 2 min read PHP | getservbyport() Function The getservbyport() function is an inbuilt function in PHP which returns the Internet service for given protocol and port number. Syntax: string getservbyport( int $port, string $protocol) Parameters: This function accepts two parameters as mentioned above and described below: $protocol: It is requi 1 min read PHP mb_decode_mimeheader() Function The mb_decode_mimeheader() function is an inbuilt function in PHP where the string is decoded into the MIME header field. Syntax: mb_decode_mimeheader(string $string): string Parameter: This function has a single parameter: string: This parameter specifies the string that is to be decoded. Return Va 1 min read PHP mhash_get_hash_name() Function The mhash_get_hash_name() function is an inbuilt function in PHP which is used to get the block size of the specified hash. It gets the highest available hash ID within the current MHash installed in the system like SHA1, MD%, etc. Syntax: string mhash_get_hash_name( int $hash ) Parameter: This func 1 min read Like