Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }