Zend Certified PHP Engineer (ZCPE) Practice Test

Question: 1 / 400

What function can be used to send a raw HTTP header in PHP?

send_header()

header()

The function that is used to send a raw HTTP header in PHP is the header() function. This function allows you to send a raw HTTP message to the client, which is essential for controlling the HTTP response and providing information like content type, caching policies, redirections, and custom response codes.

The header() function takes a string parameter that represents the HTTP header you want to send. For example, if you want to set the content type to JSON, you would use header("Content-Type: application/json"). This versatility is crucial for managing how the client interprets the response from the server.

Other functions mentioned do not exist in PHP or are not used for sending raw HTTP headers. For instance, send_header() and http_header() are not defined PHP functions, and raw_header() is also not part of the PHP core. The header() function is the definitive method provided by PHP for this purpose, making it the correct answer.

Get further explanation with Examzify DeepDiveBeta

http_header()

raw_header()

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy