Answer the question
In order to leave comments, you need to log in
How to solve a simple problem by slicing a part of an array?
There is an array, if it contains more than, say, ten elements, then you need to reduce it to ten, removing the first ones. Decided like this:
if(count($data['ids']) > 10){
$arr = array_reverse($data['ids']);
$arr = array_splice($arr, 0, 10);
$data['ids'] = array_reverse($arr);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question