You are here

function _user_relationships_get_from_array in User Relationships 5

Same name and namespace in other branches
  1. 5.3 user_relationships_ui/user_relationships_ui.module \_user_relationships_get_from_array()
  2. 5.2 user_relationships.module \_user_relationships_get_from_array()
  3. 6 user_relationships_ui/user_relationships_ui.module \_user_relationships_get_from_array()
  4. 7 user_relationships.module \_user_relationships_get_from_array()

Recursively search an array for a key and return the value attached to it

1 call to _user_relationships_get_from_array()
user_relationships_get_message in ./user_relationships_api.inc
Public API for getting the set or default message

File

./user_relationships.module, line 229

Code

function _user_relationships_get_from_array($needle, &$haystack) {
  foreach ($haystack as $key => $value) {
    if ($key == $needle) {
      return $value;
    }
    else {
      if (is_array($value)) {
        if ($msg = _user_relationships_get_from_array($needle, $value)) {
          return $msg;
        }
      }
    }
  }
}