http_response_code

PHP 5 >= 5.4.0, PHP 7, PHP 8
http_response_code - Get or Set the HTTP response code
Manual
Code Examples

Example #1 Using http_response_code in a web server environment

Result: int(200) int(404)
PHP Version:

Example #2 Using http_response_code in a CLI environment

Result: bool(false) bool(true) int(201)
PHP Version: