header_remove

It is used to remove previously set headers

<?php
 header("X-Foo: Bar");
 header("X-Bar: Baz");

echo "<pre>";print_r(headers_list());

header_remove("X-Foo"); 
 echo "<pre>";print_r(headers_list());
?>

Output

Array
(
    [0] => X-Powered-By: PHP/7.1.14
    [1] => X-Foo: Bar
    [2] => X-Bar: Baz
)Array
(
    [0] => X-Powered-By: PHP/7.1.14
    [1] => X-Bar: Baz
)

Leave a Reply

Your email address will not be published. Required fields are marked *