addUser($_POST['firstname'], $_POST['surname'], $_POST['user'], $_POST['pwd'])) { $success = true; $statusCode = 201; } } $result['success'] = $success; http_response_code($statusCode); header('Content-Type: application/json'); echo json_encode($result, JSON_UNESCAPED_UNICODE);