Annotation of embedaddon/php/ext/standard/tests/array/array_sum_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_sum() function : basic functionality
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: echo "*** Testing array_sum() : basic functionality ***\n";
11:
12: // array with integer values
13: $input = array(1, 2, 3, 4, 5);
14: echo "-- array_sum() with integer array entries --\n";
15: var_dump( array_sum($input) );
16:
17: // array with float values
18: $input = array(1.0, 2.2, 3.4, 4.6);
19: echo "-- array_sum() with float array entries --\n";
20: var_dump( array_sum($input) );
21:
22: // array with integer and float values
23: $input = array(1, 2.3, 4, 0.6, 10);
24: echo "-- array_sum() with integer/float array entries --\n";
25: var_dump( array_sum($input) );
26:
27: echo "Done"
28: ?>
29: --EXPECTF--
30: *** Testing array_sum() : basic functionality ***
31: -- array_sum() with integer array entries --
32: int(15)
33: -- array_sum() with float array entries --
34: float(11.2)
35: -- array_sum() with integer/float array entries --
36: float(17.9)
37: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>