PageArray/WireArray
Getting Items
- $a[$key]
Returns the value of the item at the given $key, or null if not set.
- $a->$key
Return the item indexed by $key or null if not found.
- $a->get($key)
Returns the value of the item at the given $key, or null if not set.
- $a->find("selector")
Return all items that match the given selector, or a blank WireArray if none found.
- $a->get("selector")
Return the first item that matches the given selector, or null if not found.
- $a->getRandom()
Returns a single random item from this WireArray.
- $a->findRandom($n)
Get $n quantity of random elements from this WireArray. Returns a WireArray (or derived type).
- $a->findRandomTimed($n, $seed='Ymd')
Get a quantity of random elements from this WireArray that always returns the same random items for the same $seed. If $seed is a string, it is considered a PHP date() string. If no $seed is provided, today's date is used to seed the random number. Meaning, the default behavior is that it returns the same random items for a period of 1 day.
- $a->slice($n)
Returns a new WireArray containing a slice of items from the $n'th item to the end.
- $a->slice($n, $limit)
Returns a new WireArray containing a slice of items starting from the $n'th item and including up to $limit number of items.
- $a->shift()
Remove (shift) the first $item from the WireArray and return it.
- $a->pop()
Pop the last item off of the WireArray and return it.
- $a->index($n)
Returns a new WireArray containing the item at the given zero-based index.
- $a->eq($n)
Returns the single item at the given zero-based index, or NULL if it doesn't exist.
- $a->first()
Returns the first item in the WireArray.
- $a->last()
Returns the last item in the WireArray.
- $a->getNext($item)
Given an item already in the WireArray, return the item that comes after it in this WireArray or NULL if no match.
- $a->getPrev($item)
Given an item already in the WireArray, return the item that comes before it in this WireArray or NULL if no match.
- $a->getArray()
Returns a regular PHP array of all items in this WireArray.
- $a->getKeys()
Returns a regular PHP array of all keys used in this WireArray.
- $a->getValues()
Returns a regular PHP array of all values used in this WireArray.
- $a->unique()
Return a new WireArray that is the same as $a but with no duplicate values.
- $a->implode([$delim], $key)
Implode all elements to a delimiter-separated string containing the given key/property from each item. Similar to PHP's implode() function.
- $a->explode($key)
Return a plain array of the requested key/property from each item. Similar to PHP's explode() function.
- $a->and($item | $items)
Return a new copy of the WireArray with the given item or items appended.