PHP developers - help wanted

Miscellaneous Forums/General Discussion/PHP developers - help wanted

To any PHP developers here, I have come across the following in some code I am trying to debug:

$cart =& $_SESSION['cart'];

I've not come across the =& operator before and can't find any information about it on the Internet. I assume this is for adding one array to another, but because I can't track down the bug in the code, I need to make sure this isn't part of the problem.

& is PHP's reference symbol

http://www.safalra.com/programming/php/references-tutorial/

Hi Game Boy,

From 'PHP in a Nutshell' : =& Reference Operator
e.g. To set $a to reference $b: $a =& $b

Regards,

Kev

Thanks guys. Didn't know you could reference variables like that - and important to know that it's not to do with attaching one array to another.

important to know that it's not to do with attaching one array to another.


You'd probably want array_merge for that.

Note that in PHP5 objects passed to a function are references by default.

Oh right, didn't know that about PHP 5. I wonder what will happen with PHP 5 now that PHP 6 already being out and PHP 5 not being massively popular on hosting servers...

Oh right, didn't know that about PHP 5. I wonder what will happen with PHP 5 now that PHP 6 already being out and PHP 5 not being massively popular on hosting servers...

As far as I know PHP6 isn't out yet, and PHP5 is very widely used (at least it's been on all the hosting services I've used in the last 2.5 years).

Well it took a long time before PHP5 was adopted by the webhosters.

That's just normal. If you're running hundreds of clients, you can't go upgrading them willy-nilly, or their sites break and they complain. Also, in a bit of a chicken and egg scenario, why rush to put it on your newer servers if everyone is still used to using the previous version? Not to mention the inevitable security issues that will pop up for the first few months.

Expect PHP6 to take just as long to penetrate the market.