array_count_values
Given an array:
<?php $arr = ['a', 'b', 'c', 'b', 'a']; ?>
Count how many times each of the letters occurs.