title: VLOOKUP IN PHP FOR A .CSV FILE
body: <p><strong>I am simply trying to do what excel calls vlookup using php based on a .csv file</strong></p>
  
  <p><strong><em>.CSV FILE is the following:</em></strong></p>
  
  <p>ID;NAME;ADDRESS<br>
  123;John;999 Street<br>
  123;John;234 Blvd<br>
  999;Mark;777 Avenue  </p>
  
  <p>I have a textbox for inputting "ID". If I type "123" and press submit I want the following result:</p>
  
  <p>123;John;999 Street<br>
  123;John;234 Blvd  </p>
  
  <p>This is what I got but I need help</p>
  
  <pre><code>if (($handle = fopen("test.csv", "r")) !== FALSE) {
      while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
        if($data[0] == '123') 
            array_push($data);
      }
      fclose($handle);
  
    var_dump($result);
  }
  ?&gt;
  </code></pre>
  
  <p>...</p>