public function arraySearch($needle, $haystack)
    {
        if (empty($needle) || empty($haystack)) {
            return false;
        }

        foreach ($haystack as $key => $value) {
            $exists = 0;
            foreach ($needle as $nkey => $nvalue) {
                if (!empty($value[$nkey]) && $value[$nkey] === $nvalue) {
                    $exists = 1;
                } else {
                    $exists = 0;
                }
            }

            if ($exists) {
                return $key;
            }
        }

        return false;
    }
public function arraySearch($needle, $haystack)
    {
        if (empty($needle) || empty($haystack)) {
            return false;
        }

        foreach ($haystack as $key => $value) {
            $exists = 0;
            foreach ($needle as $nkey => $nvalue) {
                if (!empty($value[$nkey]) && $value[$nkey] === $nvalue) {
                    $exists = 1;
                } else {
                    $exists = 0;
                }
            }

            if ($exists) {
                return $key;
            }
        }

        return false;
    }
public function arraySearch ( $ needle , $ haystack ) { if ( empty ( $ needle ) || empty ( $ haystack ) ) { return false ; } foreach ( $ haystack as $ key => $ value ) { $ exists = 0 ; foreach ( $ needle as $ nkey => $ nvalue ) { if ( ! empty ( $ value [ $ nkey ] ) && $ value [ $ nkey ] === $ nvalue ) { $ exists = 1 ; } else { $ exists = 0 ; } } if ( $ exists ) { return $ key ; } } return false ; }
Search in multidimensional array and return key.

@param array $needle   the searched data
@param array $haystack the array to search in

@return bool|int
Search in multidimensional array and return key .