Annotation of embedaddon/php/ext/standard/tests/array/array_sum_variation5.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_sum() function : usage variations - array with reference variables as elements
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: * Testing array_sum() with 'input' having reference variables as elements
12: */
13:
14: echo "*** Testing array_sum() : array with elements as reference ***\n";
15:
16: $value1 = -5;
17: $value2 = 100;
18: $value3 = 0;
19: $value4 = &$value1;
20:
21: // input array containing elements as reference variables
22: $input = array(
23: 0 => 10,
24: 1 => &$value4,
25: 2 => &$value2,
26: 3 => 200,
27: 4 => &$value3,
28: );
29:
30: var_dump( array_sum($input) );
31:
32: echo "Done"
33: ?>
34: --EXPECTF--
35: *** Testing array_sum() : array with elements as reference ***
36: int(305)
37: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>