# PayloadDifference

> Counts structural payload differences without retaining diagnostic values or their fingerprints.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Comparison](/docs/extensions/debug-core/reference/comparison/index.md) › PayloadDifference

| final readonly class | `PHPForge\Debug\Comparison\PayloadDifference` |
| --- | --- |
| Source | [`src/Comparison/PayloadDifference.php`](https://github.com/php-forge/debug-core/blob/main/src/Comparison/PayloadDifference.php#L18) |

Counts structural payload differences without retaining diagnostic values or their fingerprints.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-added"></span>`$added` readonly constructor | `int` | Leaves present only in the target payload. | `PayloadDifference` |
| <span id="property-changed"></span>`$changed` readonly constructor | `int` | Leaves present in both payloads under a different value. | `PayloadDifference` |
| <span id="property-removed"></span>`$removed` readonly constructor | `int` | Leaves present only in the baseline payload. | `PayloadDifference` |
| <span id="property-unchanged"></span>`$unchanged` readonly constructor | `int` | Leaves present in both payloads under the same value. | `PayloadDifference` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`between()`](#method-between) static | Compares typed leaves at escaped paths, treating an empty array as a leaf and `null` as an absent payload. | `PayloadDifference` |

## Method details

### between() <span id="method-between"></span>

```php
public static function between(array<string, mixed>|null $baseline, array<string, mixed>|null $target): self
```

Compares typed leaves at escaped paths, treating an empty array as a leaf and `null` as an absent payload.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$baseline` | `array<string, mixed>\|null` | Baseline payload, or `null` when not captured. |
| `$target` | `array<string, mixed>\|null` | Target payload, or `null` when not captured. |

**Returns**

`self`: Structural difference counts for the two payloads.