What are the potential pitfalls or limitations of using the "array_sum" function in PHP for summing values?

One potential limitation of using the "array_sum" function in PHP is that it may not work correctly if the array contains non-numeric values. To solve this issue, you can filter out non-numeric values from the array before using the "array_sum" function.

// Example array with non-numeric values
$array = [1, 2, 'three', 4, 5];

// Filter out non-numeric values
$numeric_values = array_filter($array, 'is_numeric');

// Sum the numeric values
$sum = array_sum($numeric_values);

echo $sum; // Output: 12