samedi 24 mars 2018

issue regarding flow of php loop

i have a foreach loop i am trying to find a match,if a match is found,then can skip from foreach loop i used break statement in if condition now i have doubt that if if condition is false then it continues foreach execution? anybody can clarify my doubt?

this is my code

foreach ($s->find('div#results', 0)->find('div.result') as $lifirsts) {

            $name1= $lifirsts->find('h4',0)->plaintext;
            $desc1=$lifirsts->find('span.description',0)->plaintext;
            $desc1=trim($desc1);
            $desc1=  strip_tags($desc1);
            $name1=trim($name1);
            $name1=  strip_tags($name1);

            if (strpos($name1,$exactsearch)!== false || strpos($desc1,$exactsearch)!== false ) {
               //$counter_exact++;

                $flag++;

                break;

            }
        }

Aucun commentaire:

Enregistrer un commentaire