You are here

public function Field::string in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/marcParse/php-marc.php \Field::string()
  2. 6 marcParse/php-marc.php \Field::string()
  3. 7.2 modules/marcParse/php-marc.php \Field::string()

Return Field as String.

Return Field formatted as String, with either all subfields or special subfields as specified.

Return value

string Formatted as String

File

modules/marcParse/php-marc.php, line 1102
@package PHP-MARC

Class

Field
Field Class Create a MARC Field object.

Code

public function string($fields = "") {
  $matches = array();
  if ($fields) {
    for ($i = 0; $i < strlen($fields); $i++) {
      if (array_key_exists($fields[$i], $this->subfields)) {
        $matches[] = $this->subfields[$fields[$i]];
      }
    }
  }
  else {
    $matches = $this->subfields;
  }
  return implode(" ", $matches);
}