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_reduce_variation3.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_reduce_variation3.phpt')
-rw-r--r-- | ext/standard/tests/array/array_reduce_variation3.phpt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_reduce_variation3.phpt b/ext/standard/tests/array/array_reduce_variation3.phpt new file mode 100644 index 0000000..f630102 --- /dev/null +++ b/ext/standard/tests/array/array_reduce_variation3.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test array_reduce() function : variation - object callbacks +--FILE-- +<?php +/* Prototype : mixed array_reduce(array input, mixed callback [, int initial]) + * Description: Iteratively reduce the array to a single value via the callback. + * Source code: ext/standard/array.c + * Alias to functions: + */ + +echo "*** Testing array_reduce() : variation - object callbacks ***\n"; + +class A { + static function adder($a, $b) {return $a + $b;} + public function adder2($a, $b) {return $a + $b;} +} + +$array = array(1); + +echo "\n--- Static method callback ---\n"; +var_dump(array_reduce($array, array("A", "adder"))); + +echo "\n--- Instance method callback ---\n"; +var_dump(array_reduce($array, array(new A(), "adder2"))); + +?> +===DONE=== +--EXPECTF-- +*** Testing array_reduce() : variation - object callbacks *** + +--- Static method callback --- +int(1) + +--- Instance method callback --- +int(1) +===DONE===
\ No newline at end of file |