Array Is Full

<?php

$array = [PHP_INT_MAX => 1];
$array[] = 2;

// Cannot add element to the array as the next element is already occupied

When using append, the next id is calculated based on the largest integer key ever used in that array. When the array has reached the biggest integer possible, a.k.a. PHP_INT_MAX, then the next-array-key generator fails, and this error is displayed.

Also, it is a fatal error to fill an array beyond its capacity.

See Also

PHP Features

Last updated: 14 July 2026