Skip to content
Chung Leong edited this page Jan 10, 2022 · 4 revisions

array_pos — Find the position of the first occurrence of a array in an array

int32 array_pos ( array $haystack, array $needle [, int32 $offset] )

array_pos() finds the numeric position of the first occurence of needle in haystack. It's the generalized version of [strpos].

Parameters:

haystack - The array to perform the search on.

needle - The "sub-string" to look for.

offset - If specified, search will start this number of elements from the beginning of haystack.

Return Value:

The position of where needle exists relative to the beginning of haystack (independent of offset). If needle does not appear in haystack, the return value is -1.

Notes:

Warning Unlike strpos() in regular PHP, array_pos() returns -1 on failure in PHP+QB and not false.

Version

1.0 and above.

Clone this wiki locally