title: Echo selective data (rows) from multidimensional array in PHP
body: <p>I have an array coming from a .csv file. These are coming from a real estate program. In the second column I have the words For Sale and in the third column the words For Rent that are indicated only on the rows that are concerned. Otherwise the cell is empty. I want to display a list rows only For Sale for example. Of course then if the user clicks on a link in one of the rows, the appropriate page will be displayed.
  I can't seem to target the text in the column, and I can't permit that the words For Sale be used throughout the entire array because they could appear in another column (description for example).
  I have tried this, but to no avail.</p>
  
  <pre><code>/* The array is $arrCSV */
  foreach($arrCSV as $book) {
      if($book[1] === For Sale) {
        echo '&lt;div&gt;';
      }
      echo '&lt;div&gt;';
      echo $book[0]. '&lt;br&gt;';
      echo $book[1]. '&lt;br&gt;';
      echo $book[2]. '&lt;br&gt;';
      echo $book[3]. '&lt;br&gt;';
      echo $book[6]. '&lt;br&gt;&lt;br&gt;&lt;br&gt;';
      echo '&lt;/div&gt;';
  }
  </code></pre>
  
  <p>I also tried this:</p>
  
  <pre><code>foreach($arrCSV as $key =&gt; $book) {
      if($book['1'] == 'For Sale') {
        echo '&lt;div&gt;';
      }
      echo '&lt;div&gt;';
      echo $book[0]. '&lt;br&gt;';
      echo $book[1]. '&lt;br&gt;';
      echo $book[2]. '&lt;br&gt;';
      echo $book[3]. '&lt;br&gt;';
      echo $book[6]. '&lt;br&gt;&lt;br&gt;&lt;br&gt;';
      echo '&lt;/div&gt;';
  }
  </code></pre>