The "chained" elements using a generator: 1 2 3 4 5
However, when it comes to converting the generator to array, there is a caveat:
Array
(
[0] => 4
[1] => 5
[2] => 3
)
The issue is caused by overlapping keys. See how they appear in the sequence:
[0] => 1
[1] => 2
[2] => 3
[0] => 4
[1] => 5
The issue is not present when the keys do not overlap:
Array
(
[0] => 1
[1] => 2
[2] => 3
[10] => 4
[11] => 5
)
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15)
/bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15)
/bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.