PageArray/WireArray
Setting and modifying items
- $a[] = $item
Add the given $item.
- $a->add($item)
Add the given $item. Supports import of page arrays (since 2.2)
- $a[$key] = $item
Add the given $item, associating it with index $key.
- $a->set($key, $item)
Add the given $item, associating it with index $key.
- $a->$key = $item
Add the given $item, associating it with index $key.
- $a->import($items)
Given an array or WireArray of items, add them all.
- $a->prepend($item)
Prepend the given item to the beginning of the WireArray.
- $a->append($item)
Append the given item to the end of the WireArray.
- $a->insertBefore($item, $existingItem)
Insert an item (int|string|array|object) before an existing item (int|string|array|object)
- $a->insertAfter($item, $existingItem)
Insert an item (int|string|array|object) after an existing item (int|string|array|object)
- $a->unshift($item)
Prepend the given item to the beginning of the WireArray (same as prepend)
- $a->shift()
Remove (shift) the first $item from the WireArray and return it.
- $a->push($item)
Push the given item onto the end of the WireArray.
- $a->pop()
Pop the last item off of the WireArray and return it.
- unset($array[$key])
Removes the item with the given $key from the WireArray.
- $a->remove($key)
Removes the item with the given $key from the WireArray.
- $a->remove($item)
Removes the given $item from the WireArray.
- $a->removeAll()
Removes all items from the WireArray.
- $a->replace($itemA, $itemB)
Replace one item with the other. 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.