title: Generating a random image with PHP
body: <p>OK, so I have a site I'm working on and need two images displayed on the page that are random. I'm running XAMPP to test it locally before it goes live. The image bank is stored in an 'images' folder in the root. The code I'm using is:</p>
  
  <pre><code>&lt;img src="images/image&lt;?php echo rand(1,9)); ?&gt;.jpg" /&gt;
  </code></pre>
  
  <p>All my images follow the naming convention of image*n*.jpg where n is incremented through the file names. As far as I'm aware, I see no reason for this code not to generate a random image on the page. All I get is a broken link image.</p>
  
  <p>EDIT: Missed the closing quotation mark for the src tag. The code does have this and it doesn't work with it.</p>