I have an easy question that I can’t seem to get my head around. Let say I have an associative array:
$myArray = array(
145 => 'Ferrari',
146 => 'Lamborghini',
147 => 'Mustang',
148 => 'Acura',
149 => 'Honda'
);
How do I return let say the last n elements from that array while maintaining the key association. I tried array_slice, but I keep getting an empty array
Any help please
Thank you
Fourth parameter of array_slice is $preserve_keys.