Replace one item with the other
- The order of the arguments does not matter.
- If both items are already present, they will change places.
- If one item is not already present, it will replace the one that is.
- If neither item is present, both will be added at the end.
Example
$items->replace($existingItem, $newItem);
Usage
$wireArray->replace($itemA, $itemB);
Arguments
Name | Type(s) | Description |
---|---|---|
itemA | Wire, string, int | |
itemB | Wire, string, int |
Return value
$this
Object instance it was called from (method supports fluent interface).
WireArray methods and properties
API reference based on ProcessWire core version 3.0.236