When I run the following code on my Azure Web App (php 7.4 or 8.0) :
<?php
try {
throw new Exception('x');
}catch (Exception $e) {
echo '1 '; // If i comment this line, http status code will be 400...
http_response_code(400);
}
echo '3 ';
echo http_response_code();
the result is "1 3 400", but when I check my http status code, I have 200 (same on several browser).
And when I comment the line echo '1 '; the http status code become 400.
From my point of view, I always expect 400 as http status code result with this code...