1--TEST--
2Test array_sum() function : usage variations - array with different integer value
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 different types of integer arrays containing data of following type:
12*  integer, octal, hexadecimal, maximum and minimum integer values & mixed of all integers
13*/
14
15echo "*** Testing array_sum() : different integer array ***\n";
16
17// Int array
18$int_values = array(3, 2, 100, 150, 25, 350, 0, -3, -1200);
19echo "-- Sum of Integer array --\n";
20var_dump( array_sum($int_values) );
21
22// Octal array
23$octal_values = array(056, 023, 090, 015, -045, 01, -078);
24echo "-- Sum of Octal array --\n";
25var_dump( array_sum($octal_values) );
26
27// Hexadecimal array
28$hex_values = array(0xAE, 0x2B, 0X10, -0xCF, 0X12, -0XF2);
29echo "-- Sum of Hex array --\n";
30var_dump( array_sum($hex_values) );
31
32// Mixed values int, octal & hex
33$mixed_int_value = array(2, 5, -1, 054, 0X3E, 0, -014, -0x2A);
34echo "-- Sum of mixed integer values --\n";
35var_dump( array_sum($mixed_int_value) );
36
37echo "Done"
38?>
39--EXPECTF--
40*** Testing array_sum() : different integer array ***
41-- Sum of Integer array --
42int(-573)
43-- Sum of Octal array --
44int(35)
45-- Sum of Hex array --
46int(-198)
47-- Sum of mixed integer values --
48int(58)
49Done
50