diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_sum_variation4.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/array_sum_variation4.phpt')
-rw-r--r-- | ext/standard/tests/array/array_sum_variation4.phpt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_sum_variation4.phpt b/ext/standard/tests/array/array_sum_variation4.phpt new file mode 100644 index 0000000..4959dee --- /dev/null +++ b/ext/standard/tests/array/array_sum_variation4.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test array_sum() function : usage variations - array with duplicate values +--FILE-- +<?php +/* Prototype : mixed array_sum(array $input) + * Description: Returns the sum of the array entries + * Source code: ext/standard/array.c +*/ + +/* +* Checking array_sum() with integer and float array containing duplicate values +*/ + +echo "*** Testing array_sum() : array with duplicate values ***\n"; + +// integer array with duplicate values +$int_input = array( 2, 5, 7, 5, 0, -4, 2, 100); +echo "-- With integer array --\n"; +var_dump( array_sum($int_input) ); + +// float array with duplicate values +$float_input = array( 2.3, 1.9, -4.1, 0.5, 1.9, -4.1, 3.6, 0.5); +echo "-- With float array --\n"; +var_dump( array_sum($float_input) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing array_sum() : array with duplicate values *** +-- With integer array -- +int(117) +-- With float array -- +float(2.5) +Done |