Re: how to invoke ReflectionMethod and pass variable by reference as argument?



On 30 Maj, 23:48, Egbert Teeselink <skreb...@xxxxxxxxx> wrote:
$rc = new ReflectionClass('K2');
$rm = $rc->getMethod('increment');
$rm->invoke($a ,$c);

Weird indeed.
Does it work when using call_user_func, or call_user_func_array maybe?
like call_user_func(array($a, 'increment'), $c) or something. it may
be the reflection lib. or i'm missing something.

both:
call_user_func(array($a, 'increment'), $c);
and
call_user_method('increment',$a,$c);
gave me the same outcome:

before: 10
after: 10

r.
.