Answers for "php array keep last 10 elements"

PHP
1

php get all elements of array except last

$array = array( 1,2, 3 );
$sliced = array_slice($array, 0, -1); // array ( 1,2 )
Posted by: Guest on July-02-2021
1

php get second last element of array

$array = array(5,6,70,10,36,2);
echo $array[count($array) -2];
Posted by: Guest on May-20-2021

Code answers related to "php array keep last 10 elements"

Browse Popular Code Answers by Language