$key = 'foo'; foreach ($filter as $value => $ignore) { $crit = $c->getNewCriterion(constant('CellphonePeer::'.strtoupper($key)), '%'.$value.'%', $this->filters[$key][4]); $c->addAnd($crit); }