Demonic Posted November 5, 2007 Share Posted November 5, 2007 I seen this a lot in IPB and vBulletin coding, what does this do? Quote Link to comment Share on other sites More sharing options...
btherl Posted November 6, 2007 Share Posted November 6, 2007 It creates a reference. You should stay away from these unless you know what you're doing A simple example: $a = 5; $b = &$a; $b = 2; print "a now has value $a\n"; When you make $b a reference to $a, the variables become shared. Changes to either one will affect both. Only one copy of the actual data is stored. PS In general it's a bad idea to use references to try to save memory. PHP already has mechanisms that save memory in most common situations where variables are copied. Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 6, 2007 Author Share Posted November 6, 2007 oh shit, like a refernces/pointers in C/C++? Quote Link to comment Share on other sites More sharing options...
trq Posted November 6, 2007 Share Posted November 6, 2007 Exactly. Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 6, 2007 Author Share Posted November 6, 2007 Thats pretty cool . 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.