Answer the question
In order to leave comments, you need to log in
How to count the number of all repetitions of elements in an array?
There is an array of m elements. Inside each element is an array of n elements. How can I count the number of repetitions of element n in any array m? For example, in the first array "3189571" the element "335976945" is repeated, it is numbered 1 and 5. As a result, you need to display all the repeating elements with the number of repetitions in the entire large array.
In our array, the number "335976945" is repeated => 5 times, so we need to display it on the screen.
I think you can check with the in_array () function or do nested loops, but the function will return only one result yes or no, and there can be many repetitions.
Array
(
[3189571] => Array
(
[0] => 128109610
[1] => 335976945
[2] =>
[3] => 144128186
[4] => 308071488
[5] => 335976945
[6] => 323896635
[n] => ...
)
[3189630] => Array
(
[0] => 335976945
[1] = > 341021680
)
[3189566] => Array
(
[0] => 175001040
[1] => 335976945
[2] => 180405054
[3] => 314998956
[4] => 347133292
[n] => ...
)
[ m] => Array
(
[0] =>335976945
[n => ...
)
)
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