// // $Revision$ // //----------------------------------------------------------------------------- require_once "../php-marc/php-marc.php"; // Other way to access file /*$string = file("example.mrc"); $file = new USMARC($string[0]);*/ // Open file $file = new File("example.mrc"); // Read next record $record = $file->next(); // Create new field $field = new Field("245", "", "", array("a" => "Mumin")); // Add subfield $field->add_subfields(array("b" => "Det Osynliga Barnet")); // Other ways to update field $field->update(array("ind2" => "1", "b" => "Vinter i Mumindalen", "c" => "Tove Jansson")); // Replace existing field $existing =& $record->field("245"); $existing->replace_with($field); $clone = $field->make_clone(); // Change some more $clone->update(array("a" => "Muminsagor", "b" => "Muminpappans memoarer")); // And append to record $record->append_fields($clone); // Some output print "<pre>"; print $record->formatted(); print "\n\n"; print $file->raw[0];