View Full Version : Clarification on &$somevar usage

09-05-2007, 12:05 PM
I am not sure so I am making an assumption (and I can't think of a good way to test it) that the use of & in front of the variable is a pointer to the original variable? The case in point is from an article I was reading.

$this->source = &$_REQUEST;

So I read this as assigning the source variable in the class with a pointer to the $_REQUEST variable. Is this correct? Can you give me another example of the use?


09-05-2007, 04:35 PM
It's always dangerous to say things a certain way with programming languages.

The basic idea is that $this->source will add a new entry in the variable table that points to the same content as $_REQUEST.

I don't think it would be right to say though that it is a pointer, and that it behaves similar. Your best bet is to look at the PHP manual [references explained] (http://us2.php.net/manual/en/language.references.php), as it has the best information out there. And you generally don't need more.

09-05-2007, 11:50 PM
Thanks. The info you pointed to was quite useful.