1--TEST--
2Test array_sum() function : usage variations - array with different float values
3--FILE--
4<?php
5/*
6 * sum of array containing different float values
7*/
8
9echo "*** Testing array_sum() : array with different float values ***\n";
10
11// Simple float array
12$float_input = array( 1.1, 2.3, 0.0, 0.5, -2.3, -0.8, .5);
13echo "-- simple float array --\n";
14var_dump( array_sum($float_input) );
15
16// float array with scientific notations
17$float_input = array( 1.2e2, 23.4e3, -4.1e2, 0.2e2, 2.1e-2, .5e3);
18echo "-- float array with scientific notations e and E --\n";
19var_dump( array_sum($float_input) );
20$float_input = array( 1.2E2, 23.4E3, -4.1E2, 0.2E2, 2.1E-2, .5E3);
21var_dump( array_sum($float_input) );
22
23// Mixed float array
24$float_input = array(
25  1.2,
26  0.5
27  -5.8,
28  6.334,
29  -0.65,
30  1.2e3,
31  -2.3e2,
32  5.56E3,
33  -3.82E-2
34);
35echo "-- Mixed float array --\n";
36var_dump( array_sum($float_input) );
37
38echo "Done"
39?>
40--EXPECT--
41*** Testing array_sum() : array with different float values ***
42-- simple float array --
43float(1.3)
44-- float array with scientific notations e and E --
45float(23630.021)
46float(23630.021)
47-- Mixed float array --
48float(6531.5458)
49Done
50