array_sum()
functionYou can use the PHP array_sum()
function to calculate the sum of all the numeric values in an array.
Let's try out the following example to understand how this function basically works:
<?php
$array1 = array(1, 2, 4.5, 8, 15);
$array2 = array("a" => 1.5, "b" => 2.5, "c" => 4.6, "d" => 10.4);
echo array_sum($array1); // Outputs: 30.5
echo "<br>";
echo array_sum($array2); // Outputs: 19
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
API Authentication in Laravel without Using Passport.
Since Laravel 5.3, Laravel Passport is t...Read the Current full URL with React
Current url holds data to display or sho...How to get Next Previous Records in Laravel7.x with Example
We all ken that, Laravel is propagating...Watch user location using Geolocation API
If you are developing real time user loc...How to get the current page url using jQuery
Use the syntax $(location).attr(&qu...