引用strposa中的当前数组元素

I'm using the simple strposa PHP function to search html pages for text.

$ItemsToGet[ ] = "Alpha One";
$ItemsToGet[ ] = "Alpha Fifty"
$ItemsToGet[ ] = "FoxTrot Twelve";
$ItemsToGet[ ] = "Bravo Six";
$ItemsToGet[ ] = "Alpha Niner";

if ( strposa( $rawPage, $itemsToGet, 1 ) !== false )
    {
    //echo the current $itemsToGet aka the element that got the match from
    //$itemsToGet
    }


function strposa( $haystack, $needles = array( ), $offset = 0 ) {
$chr = array( );
foreach ( $needles as $needle )
    {
    $res = strpos( $haystack, $needle, $offset );
    if ( $res !== false )
        $chr[ $needle ] = $res;
    }
if ( empty( $chr ) )
    return false;
return min( $chr );

}

If strposa finds a match and traverses the brackets, I'd like to add the array item it is currently on, to another array..something like so..

$foundArray[ ] = $itemsToGet;

However, I'm not sure how to reference the current element. Using current($itemsToGet) always returns the first element. Is this even possible? Do I have to find something other then strposa?

this will return the $needle instead of the position.

function strposa( $haystack, $needles = array( ), $offset = 0 ) {
$chr = array( );
foreach ( $needles as $needle )
    {
    $res = strpos( $haystack, $needle, $offset );
    if ( $res !== false )
        return $needle;
    }
return false

}