Home >> PHP >> What is difference between array_product() and array_sum() in PHP

What is difference between array_product() and array_sum() in PHP

The array_product() function used for returns the product of element in an array.

Example

$array=array(3,5,3);
echo(array_product($array));

Output

45

The array_sum() function used for the sum of values in an array.

Example

$array=array(2,5,5);
echo array_sum($array);

Output

12

Post Your Comment

Next Questions
What is the difference between session and cookie
What is session & work
What are data types
What are super global variable
$GLOBALS super global variable
$_SERVER super global variable
$_REQUEST super global variable
$_POST super global variable
$_GET super global variable
$_FILES super global variable
$_ENV super global variable
$_COOKIE super global variable
$_SESSION super global variable
Ternary operator
Variable types
What is password encrypt and decrypt function
Difference between echo and print
How can destroy and unset the variable of a session
Function
isset() function
unset() function
empty() function
What are function for controlling script execution
exit() function
die() function

Copyright ©2022 coderraj.com. All Rights Reserved.