- var_dump: documentation ( source)
<?php
class B
{
const name = 'awk';
public $name = 'awk';
function test()
{
echo __FUNCTION__ . '\n';
}
}
class Test
{
function test1(B $a, $b)
{
var_dump($a, $b);
}
}
$method = 'test1';
$class = new ReflectionClass('Test');
$test1 = $class->getMethod($method);
$args = $test1->getParameters();
$args_arr = [];
foreach ($args as $arg) {
$reflection_class = $arg->getClass();
if ($reflection_class) {
$arg = $reflection_class->newInstance();
}
$args_arr[] = $arg;
}
call_user_func_array([new Test(), $method], $args_arr);
//var_dump($args_arr);