Issue: https://github.com/php/php-src/issues/8283
Comment Author: drealecs
Given that the culprit was identified as the trigger for array copy on write operation, a common
solution in this kind of cases would be to make sure we deal with a mutable resource reference
instead of a plain array.
You will have good performance if you change the $initial parameter from
[] to new ArrayObject():
```php
$result = array_reduce($data, function ($carry, $item) {
@$carry[$item]++;
return $carry;
}, new ArrayObject())
->getArrayCopy();
```