Classes - Always References
Date: 03/08/05
(PHP Community) Keywords: no keywords
Are classes always references when assigning them to new variables? Or are copies of the class made? I'd assume the former.
For example:
$HTTP_SESSION_VARS['user'] = new User();
Later in a function foo() which assign statement should I use? And does it matter?
$user = $HTTP_SESSION_VARS['user'];
or
$user = &$HTTP_SESSION_VARS['user'];
TIA.
Source: http://www.livejournal.com/community/php/269928.html
|