for loop - php foreach print whole line not only match -


$lines = file('vairinfo.txt'); $eilutes;  for($u = 0; $u < count($vairmas) ; $u++){     $eilutes = " ";     $number = 0;     foreach ($lines $line_num => $line)     {         if (strpos($line,$vairmas[$u])!== false){             $number++;             $eilutes = $line . " ";             if($number == 2){                 echo $eilutes; 

basically, i'm trying print whole line if match correct. in mine code prints last match not matches

if need 2 or more matches if($number >= 2) more correct.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -