Can you explain the difference between count($array) before and after using array_unique in PHP?

When using count($array) before using array_unique in PHP, it will return the number of elements in the original array. However, after using array_unique, count($array) will return the number of unique elements in the array. This is because array_unique removes duplicate values from the array.

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

// Count before using array_unique
echo count($array); // Output: 7

// Remove duplicates
$array = array_unique($array);

// Count after using array_unique
echo count($array); // Output: 5