How to Calculate the Sum of Array Elements in PHP ?
Given an integer array arr of size n, find the sum of all its elements in PHP. Example: Consider the below examples:Input : arr[5] = [ 1, 2, 3, 6, 5 ]Output : 17Explanation : 1 + 2 + 3 + 6 + 5 = 17 Input : arr[] = [ 15, 12, 13, 10 ]Output : 50There are different methods to calculate the sum of array