You are here

function _patterns_array_filter in Patterns 7.2

Same name and namespace in other branches
  1. 6.2 patterns.module \_patterns_array_filter()
  2. 6 patterns.module \_patterns_array_filter()
  3. 7 includes/unused.inc \_patterns_array_filter()

Helper function to filter values of the list of matches. @TODO Doc.

1 call to _patterns_array_filter()
patterns_array_fetch in includes/unused.inc
Finds parts of an array based on a semi-compatible Xpath syntax.

File

includes/unused.inc, line 682
Functions that are unused at the moment.

Code

function _patterns_array_filter(&$matches, $operator, $value = NULL) {
  for ($i = count($matches) - 1; $i >= 0; $i--) {
    $match =& $matches[$i];
    switch ($operator) {
      case '=':
        if ($match['item'] != $value) {
          array_splice($matches, $i, 1);
        }
        break;
    }
  }
}