basic-problem / sum-array.php

SUm Array

<?php
function sumArray($arr)
{
    return array_sum($arr); // Using built-in function array_sum
}

echo sumArray([1, 2, 3, 4]); // Output: 10

SUm Array | basic-problem | Study Notes | Ferdyhape