"SPL-way"
:
$splArray = SplFixedArray::fromArray($array);
$last_item_with_preserved_index[$splArray->getSize()-1] = $splArray->offsetGet($splArray->getSize()-1);
Read more about SplFixedArray
and why it's in some cases ( especially with big-index sizes array-data) more preferable than basic array
here => The SplFixedArray class.