WireArray class - ProcessWire API

NameReturnSummary 

WireArray::count()

int

Returns the number of items in this WireArray.


Can also be used as property: WireArray::count
 

WireArray::eq(int $num)

Wire null

Returns the item at the given index starting from 0, or NULL if it doesn't exist.

 

WireArray::explode()

array

Return a plain array of the requested property from each item

 

WireArray::find($selector)

WireArray

Find all items in this WireArray that match the given selector.

 

WireArray::findOne($selector)

Wire bool

Find a single item by selector

 

WireArray::findRandom(int $num)

WireArray

Find a specified quantity of random elements from this WireArray.

 

WireArray::findRandomTimed(int $num)

WireArray

Find a quantity of random elements from this WireArray based on a timed interval (or user provided seed).

 

WireArray::first()

Wire mixed bool

Returns the first item in the WireArray or boolean false if empty.


Can also be used as property: WireArray::first
 

WireArray::get($key)

WireData Page mixed array null

Returns the value of the item at the given index, or null if not set.

 

WireArray::getAll()

$this

Returns all items in the WireArray (for syntax convenience)

 

WireArray::getArray()

array

Get a PHP array of all the items in this WireArray with original keys maintained

 

WireArray::getKeys()

array

Returns a regular PHP array of all keys used in this WireArray.

 

WireArray::getNext(Wire $item)

Wire null

Given an item, get the item that comes after it in the WireArray

 

WireArray::getPrev(Wire $item)

Wire null

Given an item, get the item before it in the WireArray

 

WireArray::getProperty(string $property)

Wire mixed

Get a predefined property of the array, or extra data that has been set.

 

WireArray::getRandom()

WireArray Wire mixed null

Get a random item from this WireArray.

 

WireArray::getValues()

array Wire

Returns a regular PHP array of all values used in this WireArray.

 

WireArray::has($key)

bool

Does this WireArray have the given item, index, or match the given selector?

 

WireArray::implode(string $delimiter)

string

Combine all elements into a delimiter-separated string containing the given property from each item

 

WireArray::index(int $num)

WireArray

Returns a new WireArray of the item at the given index.

 

WireArray::last()

Wire mixed bool

Returns the last item in the WireArray or boolean false if empty.


Can also be used as property: WireArray::last
 

WireArray::pop()

Wire mixed null

Pop an element off the end of the WireArray and return it

 

WireArray::reverse()

WireArray

Return a new reversed version of this WireArray.

 

WireArray::shift()

Wire mixed null

Shift an element off the beginning of the WireArray and return it

 

WireArray::slice(int $start)

WireArray

Get a slice of the WireArray.

 

WireArray::slices(int $qty)

array

Divide this WireArray into $qty slices and return array of them (each being another WireArray)

 

WireArray::unique()

WireArray

Return a new array that is unique (no two of the same elements)