title: simple PHP, echo all images from a directory within <li>...</li>
body: <p>I'm attempting to make a simple responsive gallery using bootstrap 3  and a simple php script to display all images in a specific directory I in response to another question on here.</p>
  
  <p>The issue I'm having is echoing the the required <code>&lt;li&gt;&lt;/li&gt;</code> tags rather then <code>&lt;br&gt;&lt;/br&gt;</code> as demonstrated below. </p>
  
  <hr>
  
  <p>here is how I currently display the images, within the <code>&lt;li&gt;&lt;/li&gt;</code>tag with a class to display the images layout/positioning, called in the <code>&lt;ul&gt;&lt;/ul&gt;</code> tag. </p>
  
  <pre><code>&lt;div class="container"&gt;
            &lt;ul class="row"&gt;
              &lt;li class="col-lg-2 col-md-2 col-sm-3 col-xs-4"&gt;
                  &lt;img class="img-responsive" src="images/kitchens.jpg"&gt;
              &lt;/li&gt;
              &lt;li class="col-lg-2 col-md-2 col-sm-3 col-xs-4"&gt;
                  &lt;img class="img-responsive" src="images/garden.jpg"&gt;
              &lt;/li&gt;
              &lt;li class="col-lg-2 col-md-2 col-sm-3 col-xs-4"&gt;
                  &lt;img class="img-responsive" src="images/front.jpg"&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
  &lt;/div&gt; &lt;!-- /container --&gt; 
  </code></pre>
  
  <p>this is the PHP im using in response to question i found here <a href="https://stackoverflow.com/a/19255786/3599850">https://stackoverflow.com/a/19255786/3599850</a></p>
  
  <pre><code>&lt;?php
  $files = glob("images/*.*");
  
  for ($i=0; $i&lt;count($files); $i++) {
      $image = $files[$i];
      print $image ."&lt;br /&gt;";
      echo             
  
      '&lt;img src="'.$image .'" alt="Random image" /&gt;'."&lt;br /&gt;&lt;br /&gt;";
  }
  
  ?&gt;
  </code></pre>
  
  <hr>
  
  <p>This is my attempt :(</p>
  
  <pre><code>&lt;?php
  $files = glob("images/*.*");
  
  for ($i=0; $i&lt;count($files); $i++) {
      $image = $files[$i];
      print $image ."&lt;br /&gt;";
      echo
  
      '&lt;li class="col-lg-2 col-md-2 col-sm-3 col-xs-4"&gt;
      &lt;img src="'.$image .'" alt="Random image" /&gt;&lt;/li&gt;'."&lt;li /&gt;&lt;li /&gt;";
  }
  
  ?&gt;
  </code></pre>