$optionName)) { return $contact->$optionName; } $out = array(); foreach ($contact as $key => $value) { if (preg_match('/^contact_notify_' . $type . '_.*/', $key) && $value == True) { $option = $this->getNotificationOptionName($key); if (strtolower($option) != 'timeperiod') { array_push($out, $option); } } } return implode($glue, $out); } }