05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

array_search<br />

mixed array_search(mixed value, array array[, bool strict])<br />

Performs a search for a value in an array, as with in_array( ). If the value is found, the key<br />

of the matching element is returned; NULL is returned if the value is not found. If strict is<br />

specified and is true, a matched element is returned only when it is of the same type and<br />

value as value.<br />

array_shift<br />

mixed array_shift(array stack)<br />

Similar to array_pop( ), but instead of removing and returning the last element in the array,<br />

it removes and returns the first element in the array. If the array is empty, or if the argument<br />

is not an array, returns NULL.<br />

array_slice<br />

array array_slice(array array, int offset[, int length])<br />

Returns an array containing a set of elements pulled from the given array. If offset is a<br />

positive number, elements starting from that index onward are used; if offset is a negative<br />

number, elements starting that many elements from the end of the array are used. If the<br />

third argument is provided and is a positive number, that many elements are returned; if<br />

negative, the sequence stops that many elements from the end of the array. If the third<br />

argument is omitted, the sequence returned contains all elements from the offset to the end<br />

of the array.<br />

array_splice<br />

array array_splice(array array, int offset[, int length[, array replacement]])<br />

Selects a sequence of elements using the same rules as array_slice( ), but instead of being<br />

returned, those elements are either removed or, if the fourth argument is provided,<br />

replaced with that array. An array containing the removed (or replaced) elements is<br />

returned.<br />

array_sum<br />

mixed array_sum(array array)<br />

Returns the sum of every element in the array. If all of the values are integers, an integer is<br />

returned. If any of the values are doubles, a double is returned.<br />

382 | Appendix A: Function Reference<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!