---
title: newrelic_insert_distributed_trace_headers
source: https://docs.newrelic.com/docs/apm/agents/php-agent/php-agent-api/newrelicinsertdistributedtraceheaders
---

## Syntax

```php
newrelic_insert_distributed_trace_headers (array $headers)
```

Inserts W3C Trace Context headers and New Relic Distributed Tracing headers into an outbound array of headers.

## Requirements

Requires PHP agent [version 9.8 or higher](https://docs.newrelic.com/docs/release-notes/agent-release-notes/php-release-notes).

## Description

Use `newrelic_insert_distributed_trace_headers` to manually add distributed tracing headers an array of outbound headers.

When Distributed Tracing is enabled, `newrelic_insert_distributed_trace_headers` will always insert W3C trace context headers. It also, by default, inserts the New Relic Distributed Tracing header, but this can be disabled via the `newrelic.distributed_tracing_exclude_newrelic_header` INI setting.

## Parameters

| Parameter          | Description                                                                                                                                                |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `$headers` _array_ | Required. An (optionally empty) array of outbound headers. This argument is passed by reference, and therefore must be a variable as opposed to a literal. |

## Return values

`true` if any headers were successfully inserted into the provided array, otherwise returns `false`

## Examples

For examples of how and when to use this API method, see the documentation to [manually instrument applications and services](https://docs.newrelic.com/docs/agents/php-agent/features/distributed-tracing-php#manual).
