Puoi provare qualcosa del genere:
una domanda: ogni itemdef contiene tutti i campi sempre?Codice PHP:<?php
$fp = fopen('data.txt', 'r');
$data = array();
while (!feof($fp)) {
$line = rtrim(fgets($fp));
if (strpos($line, 'ITEMDEF')) {
if (!empty($data)) {
// esegui query inserimento usando l'array $data
$data = array();
}
} else {
list($key, $val) = explode('=', $line);
$data[strtolower($key)] = $val;
}
}
// esegui query inserimento usando l'array $data
?>

Rispondi quotando