What are some efficient ways to count occurrences of specific values in PHP arrays?

When working with PHP arrays, counting the occurrences of specific values can be efficiently done using the `array_count_values()` function. This function takes an array as input and returns an associative array where keys are the unique values from the input array and values are the count of occurrences of each value.

// Sample array
$array = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4];

// Count occurrences of specific values
$valueCounts = array_count_values($array);

// Output the count of occurrences
foreach ($valueCounts as $value => $count) {
    echo "Value: $value, Count: $count" . PHP_EOL;
}