CKTIS / PHP
header()
Queue an HTTP response header before output is sent.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
header(string $header, bool $replace = true, int $response_code = 0): voidQueue an HTTP response header before output is sent. A header of the same name is normally replaced, while false appends another field. A Location header normally selects 302 unless a 201 or 3xx code is already set. The third argument can specify the redirect status explicitly.
Signature
header(string $header, bool $replace = true, int $response_code = 0): void
Example output
307
Examples
<?php
header("Location: /archive",true,307);
echo http_response_code();
Result
307