You are here

function _user_relationships_get_from_array in User Relationships 7

Same name and namespace in other branches
  1. 5.3 user_relationships_ui/user_relationships_ui.module \_user_relationships_get_from_array()
  2. 5 user_relationships.module \_user_relationships_get_from_array()
  3. 5.2 user_relationships.module \_user_relationships_get_from_array()
  4. 6 user_relationships_ui/user_relationships_ui.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.module
Public API for getting the set or default message

File

./user_relationships.module, line 1053
User Relationships API. Module shell.

Code

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