3 ms·
They ARE implemented as COW. It's discouraged to use explicit reference passing if you don't want to alter the array as PHP has to do a slight bit more work if
by pilif 16y ago
They ARE implemented as COW. It's discouraged to use explicit reference passing if you don't want to alter the array as PHP has to do a slight bit more work if you pass a reference.
I think copy on write was added in the 5.1 timeframe (around 2005)
- edtechre 16y agoThanks for the info. I do think the default should have been pass by reference though, like with objects since PHP5.
- pilif 16y agoArrays (and everything else) should be objects. That would also solve the pass-by-reference issue and would clean up the global namespace that's littered with array_* functions.
- deleted 16y ago[deleted]
- wvenable 16y agoCopy-on-write has been around a lot longer than 5.1. I'd venture to say PHP 4 but someone will likely reply and say it was even earlier.