1--TEST--
2Test array_reduce() function : variation
3--FILE--
4<?php
5/* Prototype  : mixed array_reduce(array input, mixed callback [, int initial])
6 * Description: Iteratively reduce the array to a single value via the callback.
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11echo "*** Testing array_reduce() : variation ***\n";
12
13
14function oneArg($v) {
15  return $v;
16}
17
18function threeArgs($v, $w, $x) {
19  return $v + $w + $x;
20}
21
22$array = array(1);
23
24echo "\n--- Testing with a callback with too few parameters ---\n";
25var_dump(array_reduce($array, "oneArg", 2));
26
27echo "\n--- Testing with a callback with too many parameters ---\n";
28var_dump(array_reduce($array, "threeArgs", 2));
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing array_reduce() : variation ***
34
35--- Testing with a callback with too few parameters ---
36int(2)
37
38--- Testing with a callback with too many parameters ---
39
40Warning: Missing argument 3 for threeArgs() in %sarray_reduce_variation1.php on line %d
41
42Notice: Undefined variable: x in %sarray_reduce_variation1.php on line %d
43int(3)
44===DONE===