You are here

function _in_array in Recipe 6

Same name and namespace in other branches
  1. 5 recipe.module \_in_array()

$ingredient_list may be an array of objects or an array of array elements.

File

./recipe.module, line 1080
recipe.module - share recipes

Code

function _in_array($ingredient_object, $ingredient_list) {
  foreach ($ingredient_list as $i) {
    $i_name = '';
    if (is_array($i)) {
      $i_name = trim(strtolower($i['name']));
    }
    else {
      $i_name = trim(strtolower($i->name));
    }
    if (strtolower($ingredient_object->name) === $i_name) {
      return TRUE;
    }
  }
  return FALSE;
}