$n
is equal to the number of items you want off the end.
$arr = array_slice($old_arr, -$n);
More Related Contents:
- How do search array values and remove them based on a condition or string? [closed]
- how can I print multiple services in this way
- Remove Duplicates in array php
- How to Flatten a Multidimensional Array?
- PHP Sort a multidimensional array by element containing Y-m-d H:i:s date
- + operator for array in PHP?
- How to push both value and key into PHP array
- How to bind mysqli bind_param arguments dynamically in PHP?
- php multi-dimensional array remove duplicate [duplicate]
- How to create an array from a CSV file using PHP and the fgetcsv function
- array_splice() for associative arrays
- Group array data on one column and sum data from another column
- Is it necessary to declare PHP array before adding values with []?
- Explode a string to associative array without using loops? [duplicate]
- Check if specific array key exists in multidimensional array – PHP
- How to get all combinations from multiple arrays?
- PHP Array Syntax Parse Error Left Square Bracket “[” [closed]
- Keep Duplicates while Using array_diff
- Re-index numeric array keys [duplicate]
- More concise way to check to see if an array contains only numbers (integers)
- Is PHP’s count() function O(1) or O(n) for arrays?
- How to search in an array with preg_match?
- PHP – count specific array values
- Sort an array of associative arrays by column value
- Insert elements from one array (one-at-a-time) after every second element of another array (un-even zippering)
- Convert a String to Variable
- How do I select 10 random things from a list in PHP?
- PHP – How to send an array to another page?
- Array size limit in PHP
- How are associative arrays implemented in PHP?