1--TEST-- 2Test array_reduce() function : variation - object callbacks 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 - object callbacks ***\n"; 12 13class A { 14 static function adder($a, $b) {return $a + $b;} 15 public function adder2($a, $b) {return $a + $b;} 16} 17 18$array = array(1); 19 20echo "\n--- Static method callback ---\n"; 21var_dump(array_reduce($array, array("A", "adder"))); 22 23echo "\n--- Instance method callback ---\n"; 24var_dump(array_reduce($array, array(new A(), "adder2"))); 25 26?> 27===DONE=== 28--EXPECTF-- 29*** Testing array_reduce() : variation - object callbacks *** 30 31--- Static method callback --- 32int(1) 33 34--- Instance method callback --- 35int(1) 36===DONE=== 37