How can the PHP code be further optimized for better performance and readability?

Issue: The PHP code can be further optimized for better performance and readability by using more efficient functions and techniques, such as using built-in PHP functions instead of custom functions and optimizing loops. Code snippet:

// Original code
$result = 0;
for ($i = 0; $i < count($array); $i++) {
    $result += $array[$i];
}

// Optimized code
$result = array_sum($array);