Assuming $_POST will always contain your POST data

Despite its name, the $_POST array won’t always contain your POST data and can be easily found empty. To understand this, let’s take a look at an example. Assume we make a server request with a jQuery.ajax() call as follows:

<script>
// js 
$.ajax({ url: 'http://my.site/some/path', method: 'post', data: JSON.stringify({a: 'a', b: 'b'}), contentType: 'application/json' });
</script>

Since $_POST is a superglobal, if we override it once (preferably early in our script), the modified value (i.e., including the POST payload) will then be referenceable throughout our code.

<?php
// php 
$_POST = json_decode(file_get_contents('php:input'), true);
array(2) { ["a"]=> string(1) "a" ["b"]=> string(1) "b" }
?>

https://www.toptal.com/php/10-most-common-mistakes-php-programmers-make