PHP script that returns an error message based on what $_POST parameters are missing
if (empty($_POST[$item]) || !array_key_exists($item, $_POST)) { is literally checking if $_POST[$item] is not declared or is falsey THEN checking if $_POST[$item] is not declared.

// Check for nulls or non existent payload


The comment associated with the step indicates that you want to check if $_POST elements are not declared or are null.  In this case, you should only use: if (!isset($_POST[$item])) {.
If you want to check that elements are not declared or empty/falsey, then use:if (empty($_POST[$item])) {.

if ($missingCount &gt; 0) { can be safely reduced to if ($missingCount) { which checks if the count is &quot;truthy&quot; (in other words, not zero).

else if is one word in php, please always type elseif to comply with PSR guidelines.

Don't bother declaring $missingString = ''; if you are unconditionally going to overwrite it anyhow.

You can combine the if and first else if because if the array only has one element, then no glue will be used while producing the output string.
if ($missingCount &lt; 3) {
     $missingString = implode(' and ', $missing);
}


The &quot;smart-implode&quot; as I've seen it referred to at least once on StackOverflow is fine enough.  There are a few other ways to do it -- I'll show another one below.

The whole chunk of code that crafts the OutputResponse might look like this: (Demo).  The advantages are: fewest declared variables (specifically no single-use variables), not repeated function calls, and the elegance of sprintf() when injecting variables into a string.
$missingCount = count($missing);
if ($missingCount) {
    if ($missingCount &lt; 3) {
         $glue = ' and ';
    } else {
         $glue = ', ';
         $missing[] = 'and ' . array_pop($missing);
    }
    OutputResponse::sendResponse(
        400,
        sprintf(
            'Incomplete information received. The %s %s missing. Please check your inputs and try again.',
            implode($glue, $missing),
            $missingCount === 1 ? 'field is' : 'fields are'
        )
    );
}


[EDITED] After reading the other reviews and learning that my recommended lookup array was incomplete, flawed, and frankly suboptimal, I now find myself agreeing with YourCommonSense's advice to use http_response_code() for setting the HTTP response code.  See this Stack Overflow page for additional considerations and fringe cases around the native function which was available since PHP5.4. Also,  Now I suppose my new code for the sendResponse() method would look like this:
 http_response_code($statusCode);
 header('Content-Type: application/json');
 exit(
     json_encode([
         'code' =&gt; $statusCode,
         'data' =&gt; $messageBody
     ])
 );