This is because the code below will return false if string "/charge" doesn't exists and 0 (falsy value) if exists.
!strpos($_SERVER['REQUEST_URI'], '/charge')
To fix this, you should explicitly check if strpos returns false instead of relying on the falsy nature of 0. Here's the corrected code:
if (strpos($_SERVER['REQUEST_URI'], '/charge') === false) {
http_response_code(404);
echo "wrong path, make sure it's `/charge`";
exit();
}
This is because the code below will return false if string "/charge" doesn't exists and 0 (falsy value) if exists.
To fix this, you should explicitly check if strpos returns false instead of relying on the falsy nature of 0. Here's the corrected code: