public static function fastIntersect($array1, $array2)
    {
        $sharedValues = array();
        $flippedArray2 = array_flip($array2); # swaps indexes and values
       
        foreach ($array1 as $value)
        {
            if (isset($flippedArray2[$value])) 
            {
                $sharedValues[] = $value;
            }
        }
        
        return $sharedValues;
    }