PHP Question

She has: 88 posts

Joined: Sep 2001

I have program written by someone whom I'm not able to contact. I'm needing to revise this script and I've run into an operator(??) I've never seen before and can't find a reference to it. Here's the snippet of code in question:

$MainContents =& ob_get_contents();

What does the =& mean?

Thanks. Any insights you can provide would be appreciated.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Welcome to TWF, Dami.

That's a reference. I've not used them, so all I can do is point you to the PHP Docs:
Chapter 14. References Explained

She has: 88 posts

Joined: Sep 2001

Well, I can see that's way beyond my meager abilities. Smiling Thanks for the link, Mark. I'd searched there, but obviously not in the right area.

They have: 447 posts

Joined: Oct 1999

'&' is the bitwise AND operator, bits in both operands are set. any operator trailing a '=' such as +=, *=, %= etc will the left value the result of the operation between left and right value. for instance $a=5; $a*=10; // result is $a = 500.

They have: 447 posts

Joined: Oct 1999

i now see that it's =& not &=, doh on me.

$MainContents =& ob_get_contents();

assigns a reference to ob_get_contents in $MainContents

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Howard, isn't the amp on the wrong side?

She has: 88 posts

Joined: Sep 2001

Thanks, guys, for the information. Sorry to take so long to acknowledge your comments. 99% of what you said was so over my head. I'll back up and bit and start with smaller steps. Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.