1--TEST--
2Test array_sum() function : usage variations - array with duplicate values
3--FILE--
4<?php
5/* Prototype  : mixed array_sum(array $input)
6 * Description: Returns the sum of the array entries
7 * Source code: ext/standard/array.c
8*/
9
10/*
11* Checking array_sum() with integer and float array containing duplicate values
12*/
13
14echo "*** Testing array_sum() : array with duplicate values ***\n";
15
16// integer array with duplicate values
17$int_input = array( 2, 5, 7, 5, 0, -4, 2, 100);
18echo "-- With integer array --\n";
19var_dump( array_sum($int_input) );
20
21// float array with duplicate values
22$float_input = array( 2.3, 1.9, -4.1, 0.5, 1.9, -4.1, 3.6, 0.5);
23echo "-- With float array --\n";
24var_dump( array_sum($float_input) );
25
26echo "Done"
27?>
28--EXPECTF--
29*** Testing array_sum() : array with duplicate values ***
30-- With integer array --
31int(117)
32-- With float array --
33float(2.5)
34Done
35