views:

45

answers:

1

Consider the following code:

class myclass
{
  function __construct(&$arg1, &$arg2)
  {
    echo $arg1;
    echo $arg2;
  }
}

How do I know that constructor above has arguments passed by reference through code?

Edit:

I am looking for detecting of they are passed by reference programatically something like this:

   is_passed_by_ref($arg1, etc);
+4  A: 

As the arguments are declared as "passed by reference" (because of the & in the declaration of your method), they just... are.

There is no "are the arguments passed by reference ?" : as you declared your method was receiving its parameters by reference, they are passed by reference.

Pascal MARTIN
Sarfraz
I'm sorry, but I don't quite understand what you mean : if your parameters are declared as received by reference (with the no more, no less ?
Pascal MARTIN
I mean how do i detect whether a certain function's argumenets are passed by reference of not without actually looking at the function. Let's assume that function is coming from any user for my framework, the user has made a class/function now i need to know programatically whether his function is having argumenets passed by reference or not. I hope i clarify this time.
Sarfraz