PHP 8.5.0 Beta 1 available for testing

Voting

: five minus two?
(Example: nine)

The Note You're Voting On

Paul
19 years ago
In PHP 4.3.10, at least, it seems that elements that are inserted as part of the replacement array are inserted BY REFERENCE (that is, as though with the =& rather than = assignment operation). So if your replacement array contains elements that references to variables that you can also access via other variable name, then this will be true of the elements in the final array too.

In particular, this means that it is safe to use array_splice() on arrays of objects, as you won't be creating copies of the objects (as it is so easy to do in PHP 4).

<< Back to user notes page

To Top