$CURRENTZONE = []; } $RECORD = new stdClass(); $RECORD->name = $LINE[0]; array_shift($LINE); $RECORD->ttl = $LINE[0]; array_shift($LINE); $RECORD->class = $LINE[0]; array_shift($LINE); $RECORD->type = $LINE[0]; array_shift($LINE); $RECORD->rr = implode(" ", $LINE); array_push($ZONE->$CURRENTZONE, $RECORD); unset($RECORD); } printf(json_encode($ZONE));