1--TEST--
2Test array_reduce() function : variation
3--FILE--
4<?php
5echo "*** Testing array_reduce() : variation ***\n";
6
7
8function oneArg($v) {
9  return $v;
10}
11
12function threeArgs($v, $w, $x) {
13  return $v + $w + $x;
14}
15
16$array = array(1);
17
18echo "\n--- Testing with a callback with too few parameters ---\n";
19var_dump(array_reduce($array, "oneArg", 2));
20
21echo "\n--- Testing with a callback with too many parameters ---\n";
22try {
23    var_dump(array_reduce($array, "threeArgs", 2));
24} catch (Throwable $e) {
25    echo "Exception: " . $e->getMessage() . "\n";
26}
27
28?>
29--EXPECT--
30*** Testing array_reduce() : variation ***
31
32--- Testing with a callback with too few parameters ---
33int(2)
34
35--- Testing with a callback with too many parameters ---
36Exception: Too few arguments to function threeArgs(), 2 passed and exactly 3 expected
37