Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

header_register_callback

Description

Call a header function

Syntax

header_register_callback ( callable $callback ) : bool

Parameters

callback

Function called just before the headers are sent. It gets no parameters and the return value is ignored.

Return

Returns TRUE on success or FALSE on failure.

Examples

1

<?

header('Content-Type: text/plain');
header('X-Test: test');

function test() {
 foreach (headers_list() as $header) {
   if (strpos($header, 'X-Powered-By:') !== false) {
     header_remove('X-Powered-By');
   }
   header_remove('X-Test');
 }
}

$result = header_register_callback(test());

print_r(headers_list());
echo "a";

?>
HomeMenu