Tribe__Utils__Array::strpos( string $haystack, array|string $needles, int $offset )

Behaves exactly like the native strpos(), but accepts an array of needles.

See also


Top ↑

Parameters

$haystack

(string) (Required) String to search in.

$needles

(array|string) (Required) Strings to search for.

$offset

(int) (Required) Starting position of search.


Top ↑

Return

(false|int) Integer position of first needle occurrence.


Top ↑

Source

File: src/Tribe/Utils/Array.php

	public static function strpos( $haystack, $needles, $offset = 0 ) {
		$needles = (array) $needles;

		foreach ( $needles as $i ) {
			$search = strpos( $haystack, $i, $offset );

			if ( false !== $search ) {
				return $search;
			}
		}

		return false;
	}