function testRecursiveArraySearch() { $haystack = array("Foo" => "own", "Bar" => "Cloud"); $result = OC_Helper::recursiveArraySearch($haystack, "own"); $expected = "Foo"; $this->assertEquals($result, $expected); $result = OC_Helper::recursiveArraySearch($haystack, "NotFound"); $this->assertFalse($result); }
/** * performs a search in a nested array * * @param array $haystack the array to be searched * @param string $needle the search string * @param int $index optional, only search this key name * @return mixed the key of the matching field, otherwise false * @since 4.5.0 */ public static function recursiveArraySearch($haystack, $needle, $index = null) { return \OC_Helper::recursiveArraySearch($haystack, $needle, $index); }