PHP | headers_list() Function Last Updated : 31 Jan, 2019 Summarize Comments Improve Suggest changes Share 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 | header() 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 Like