TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
727 B
33 lines
727 B
--TEST--
|
|
Test array_reduce() function : variation - object callbacks
|
|
--FILE--
|
|
<?php
|
|
class A
|
|
{
|
|
static function adder($a, $b)
|
|
{
|
|
return $a + $b;
|
|
}
|
|
public function adder2($a, $b)
|
|
{
|
|
return $a + $b;
|
|
}
|
|
}
|
|
function main()
|
|
{
|
|
echo "*** Testing array_reduce() : variation - object callbacks ***\n";
|
|
$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")));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
*** Testing array_reduce() : variation - object callbacks ***
|
|
|
|
--- Static method callback ---
|
|
int(1)
|
|
|
|
--- Instance method callback ---
|
|
int(1)
|
|
|