What is the impact of performance considerations when implementing a script that counts array values in PHP?

When implementing a script that counts array values in PHP, performance considerations are important to ensure efficient execution. One way to improve performance is to use built-in PHP functions like array_count_values() to efficiently count the occurrences of each value in the array.

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

// Count occurrences of each value in the array
$valueCounts = array_count_values($array);

// Output the counts
foreach ($valueCounts as $value => $count) {
    echo "Value $value occurs $count times<br>";
}