Core PHP

Basic Array Functions

Basic Array Functions
array()
array array(various $qFirst, ... )
This function returns an array of the elements that were passed into it arguments. The arguments can be of any type. They can also be passed in as key and value pairs via the arrow operator: =>. For example, we can use "name" => "XoaX.net" as an argument in the array to set the array to index the value "XoaX.net" with the index "name," if we wish. If no key is specified, the entries are indexed with successive integers, starting at zero. Every time an index is omitted, the next largest unused index is used.
Argument Description
various $qFirst This is the first entry in the array.
array_pop()
various array_pop(array $qaArray)
This function removes the last entry from the array $qaArray and returns it. If $qaArray is empty, the function returns null. The function will throw E_WARNING if the argument is not an array.
Argument Description
array $qaArray This is the array that is to be popped.
array_push()
int array_push(array $qaArray, various $qValue, ...)
This function appends the value $qValue and all additional values that might come after it to end of the array $qaArray and returns the size of the array $qaArray that results.
Argument Description
array $qaArray The array to which the values are being added.
various $qValue, ... The values that are being appended to the array.
array_shift()
various array_shift(array &$qarArray)
This function returns the first value in the array and removes it from the array. All of the remaining entries are moved forward one. So, the numerical keys of all entries will be decremented, but the string-valued keys will remain the same. If the array is empty or $qaArray is not an array, the function returns null.
Argument Description
array &$qarArray The first entry of this array is removed and returned.
array_unshift()
int array_unshift(array &$qarArray, various $qValue1, ...)
This function prepends the passed in values to the beginning of array $qaArray. This will add the number of prepended entries to the numerical keys of the array entries. The value returned is the new size of array $qaArray.
Argument Description
array &$qarArray This is the array to which the values will be prepended, that is added to the beginning of this array.
various $qValue1, ... These are the values that are prepended. They are prepended in the same order in which they listed in the argument list.
current()
various current(array|object $xArray)
This function returns element to which the internal pointer points. If the internal pointer does not point to a valid entry, the function returns false.
Argument Description
array|object $xArray This array or object that is being considered.
end()
various end(array|object &$xrArray)
This function moves the internal pointer of the array $qarArray to the last entry and returns its value. If the array $qarArray is empty, the function returns false.
Argument Description
array|object &$xrArray This array or object that is being considered.
key()
int|string|null key(array|object $xArray)
This function returns the key of $xArray to which the internal pointer points. If $xArray is an empty array or the pointer points outside the array range, the function returns null.
Argument Description
array|object $xArray This is the array from which the key is returned.
next()
various next(array|object &$xrArray)
This function advances internal pointer and the returns new element to which the internal pointer points. If the internal pointer does not point to a valid entry, the function returns false.
Argument Description
array|object &$xrArray This array or object that is being used.
pos()
various pos(array|object $xArray)
This function returns element to which the internal pointer points. This is the same as current(). If the internal pointer does not point to a valid entry, the function returns false.
Argument Description
array|object $xArray This array or object that is being considered.
prev()
various prev(array|object &$xrArray)
This function moves the internal pointer backward and the returns new element to which the internal pointer points. If the internal pointer does not point to a valid entry, the function returns false.
Argument Description
array|object &$xrArray This array or object that is being used.
reset()
various reset(array|object &$xrArray)
This function moves the internal pointer to the first entry and the returns new element to which the internal pointer points. If the internal pointer does not point to a valid entry, the function returns false.
Argument Description
array|object &$xrArray This array or object that is being used.
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.