Possible Duplicate:
Remove elements from array?
how would I remove all array elements but last 5 ones? The array is a log, but the log will become extensive so I just want to see the five recent items (a.k.a. last five elements)
Use array_slice
:
$a5 = array_slice($arr, -5);
$new = array_slice($old, -5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With