Answer the question
In order to leave comments, you need to log in
How to extract a certain number of elements from an array?
I have an array $caon in which there are 10 values, 1,2,3,4,5,6,7,8,9,10 how, for example, to extract only 5 from this array? for example to another array.
Answer the question
In order to leave comments, you need to log in
$result = array_slice($caon, 0, 5);
php.net/manual/en/function.array-slice.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question