I have a multidimensional array where I need to get the count of similar values in a specific index and create a new array with the results. I am using PHP 7.3.
For example, I need to count the number of similar values in index [3] .
Desired results MUFA-D = 2, BRD-IS = 3, JBC-BAK-B = 1.
[0] => Array
(
[0] => CHICAGO
[1] => 14
[2] => MUFFIN A LINE
[3] => MUFA-D
[4] => Arm Bearings - Check for play, lubricate if needed.
)
[1] => Array
(
[0] => CHICAGO
[1] => 14
[2] => MUFFIN A LINE
[3] => MUFA-D
[4] => Linkage - Check for wear and broken links.
)
[2] => Array
(
[0] => MEMPHIS
[1] => 05
[2] => BREADING LINE 1
[3] => BRD1-IS
[4] => Gear Box oil level
)
[3] => Array
(
[0] => MEMPHIS
[1] => 05
[2] => BREADING LINE 1
[3] => BRD1-IS
[4] => Bearings visual inspection
)
[4] => Array
(
[0] => MEMPHIS
[1] => 05
[2] => BREADING LINE 1
[3] => BRD1-IS
[4] => Electrical Plug condition
)
[5] => Array
(
[0] => CHICAGO
[1] => 02
[2] => JBC LINE 2
[3] => JBC-BAK-B
[4] => Plate separator shaft
)
)