You are here

function _in_array in Recipe 5

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

Custom in_array() function because PHP 4 in_aray() doesnt seem to handle the first arguement being an object

2 calls to _in_array()
recipe_ingredients_diff in ./recipe.module
Compares two arrays of ingredients and returns the differences
recipe_validate in ./recipe.module
Implementation of hook_validate().

File

./recipe.module, line 754
recipe.module - share recipes for drupal 5.x

Code

function _in_array($a, $b) {
  $a->name = trim(strtolower($a->name));
  foreach ($b as $row) {
    $compareto = "";
    if (is_array($row)) {
      $compareto = trim(strtolower($row["name"]));
    }
    else {
      $compareto = trim(strtolower($row->name));
    }
    if ($a->name === $compareto) {
      return true;
    }
  }
  return false;
}