jeboy Posted April 30, 2008 Share Posted April 30, 2008 What is the purpose of "=&"? e.g. $var =& new object($subject); Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 30, 2008 Share Posted April 30, 2008 The & operator is the reference operator. A reference is like an alias - if one variable is a reference to another, then a change to either will result in both changing: <?php $var = 'foobar'; $var2 = &$var; $var = 'test'; echo $var2; ?> Quote Link to comment Share on other sites More sharing options...
jeboy Posted April 30, 2008 Author Share Posted April 30, 2008 The & operator is the reference operator. A reference is like an alias - if one variable is a reference to another, then a change to either will result in both changing: <?php $var = 'foobar'; $var2 = &$var; $var = 'test'; echo $var2; ?> In your example ($var2 = &$var), does it differ from $var =& new object(); ? Because it's an assignment operator which instantiate an object and call it $var. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.