import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / array_reduce_variation3.php
blobb50c72269e674ed820c9db2d59cf3c0e3c762080
1 <?php
2 /* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
3 * Description: Iteratively reduce the array to a single value via the callback.
4 * Source code: ext/standard/array.c
5 * Alias to functions:
6 */
8 echo "*** Testing array_reduce() : variation - object callbacks ***\n";
10 class A {
11 static function adder($a, $b) {return $a + $b;}
12 public function adder2($a, $b) {return $a + $b;}
15 $array = array(1);
17 echo "\n--- Static method callback ---\n";
18 var_dump(array_reduce($array, array("A", "adder")));
20 echo "\n--- Instance method callback ---\n";
21 var_dump(array_reduce($array, array(new A(), "adder2")));
24 ===DONE===