Search code examples
phptabular

Show table row if a value is present


I have a file that I scrape with PHP. It has 3 rows and 3 columns and has these values

John - 35000 - OL
Adam - 4000 - AF
John - 5000 - XS

What I am trying to do is to show only the row(s) that contain(s) the word "John" How can I do it?


Solution

  • foreach($rows as $row){
      if(strpos('John') !== false)
        echo $row;
    }