Menu

Reference / Http

reason()

function
function reason(int $code): string

The reason phrase for a status code, or '' for a code that has no phrase here.

Covers the 1xx-5xx codes listed in Status. Status::text() calls this.

Parameters

$code int
HTTP status code.

Returns

string — The phrase (404 gives Not Found), or an empty string for an unknown code.

View source