function extractCSV2($files_csv2, $files_csv1){ $url_extracted = array(); if(!empty($files_csv2) && !empty($files_csv1)){ $filesToBe = file("uploaded/files/".$files_csv2); $files_csv1 = fopen("uploaded/files/".$files_csv1, "r"); foreach ($filesToBe as $csv2) { list($date, $content, $url_content, $url) = explode(",", $csv2); $str_content = explode("-",$url_content); $csv_final = strtolower(preg_replace('/"/', '', $str_content[0])); while ($userinfo = fscanf($files_csv1, "%s\t%s\t%s\n")) { list ($url_content) = $userinfo; $url_content = preg_replace('/"/', '', $url_content); preg_match('@^(?:http://)?([^/]+)@i', $url_content, $matches); $host = $matches[1]; preg_match('/[^.]+\.[^.]+$/', $host, $match_url); $url_extracted[] = strtolower($match_url[0]); } if(in_array($csv_final, $url_extracted)) { echo "".$csv_final.""." - ".$url_extracted."<br>"; $this->createNewFile($date, $content, $url_content, $url); } } } } Why if() return nothing on foreach loop? Somebody help me. LearnCareGo missions mobilization for local churches --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. [Non-text portions of this message have been removed]