Tub
Joined: 6/25/2005
Posts: 1377
Problably because in php, a reference is not just a plain and simple pointer, it's a 'symbol table alias' as the documentation says. And "symbol table alias" sounds like something with enough overhead to choke a horse. Somewhere the php manual stated that references shouldn't be used to increase performance (because they don't), but I can't find where. as for the bug: good find, anubis.
m00
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
I don't understand why "symbol table alias" "sounds like something with overhead", but if PHP references are indeed much more than C++ (or Java) references, then it might well be that using references should be avoided when coding PHP, especially if it's specifically stated that associative arrays use CoW.
Tub
Joined: 6/25/2005
Posts: 1377
Tub wrote:
Somewhere the php manual stated that references shouldn't be used to increase performance (because they don't), but I can't find where.
accidentally stumbled upon it:
Note: There is no performance loss (since PHP 4 and up use reference counting) returning copies instead of references. On the contrary it is most often better to simply work with copies instead of references, because creating references takes some time where creating copies virtually takes no time.
source
m00