Re: if() problem inside foreach() loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I suggest you to perform a step by step test in each instance of foreach,
before the if structure and verify its content. Doing so, you can be sure
the problem is in the if.

2008/4/3, Raul Berina <raul_berina_fq@xxxxxxxxx>:
>
>   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]
>
>  
>



-- 
Altamiro Teixeira de Souza


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux