$header_data = ['Media|Print A/S', 'Skt. Petri Passage 5, 2nd floor', '1165 Copenhagen - Denmark', '+45 8230 4200', 'Bødker Balles Gård 15', '8000 Aarhus, Denmark', '+45 8230 4200', 'CVR: DK28865554']; if (!stristr($rows[0], $page_heading)) { $rows[0] = $page_heading . ' ' . $rows[0]; } try { foreach ($rows as $index => $_row) { $_row = trim($_row); if (in_array($_row, $header_data)) { continue; } switch ($status) { case BEGINING: // Checking if beginning of page if (stristr($_row, $page_heading)) { $numberArray = explode(' ', $_row); $Offer->setEnquiryNumber($numberArray[1]); $status = MEGAMEDIA_ADDRESS; } break; case MEGAMEDIA_ADDRESS: // We do not need to handle the megamedia address // because we know it already. // @todo Add checks if too many rows have been parsed if ($_row == MEGAMEDIA_ADDRESS_FINAL) { if ($current_page == 1) { $status = BEGINING_CONTENTS_PAGE; } else { $status = BEGINING_PRODUCT_PAGE; } } break;