Documentation - astrpos()

Description

  • int astrpos ( string $haystack, array $needles [, $offset [, int $flags ] ] )

    Returns the numeric position of either the first needle found in the haystack, or the first instance of a needle in the haystack.

Parameters

  • haystack

    The string to search in

  • needle

    An array of strings to search in the haystack for

  • offset

    The optional offset parameter allows you to specify which character in haystack to start searching. The position returned is still relative to the beginning of haystack.

  • flags

    Option settings for how the search is conducted:

    • ASTR_NEEDLE_ORDER returns the first instance of a needle
    • ASTR_STRING_ORDER retusn the first instance of any needle

Return Values

  • Returns the position as an integer. If needle is not found, astrpos() will return Boolean false.

    Warning: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or "". Make sure to use the === operator for testing the return value of this function.