public static function recursiveArraySearch($needleKey, $needleValue,
                                                array $haystack)
    {
        foreach ($haystack as $key => $value) {
            $currentKey = $key;

            if (($currentKey == $needleKey && ($needleValue === null || $needleValue
                == $value)) || ( is_array($value) && self::recursiveArraySearch($needleKey,
                    $needleValue, $value) !== false)) {
                return $currentKey;
            }
        }
        return null;
    }