PHP - Randomly grab a file from folder and echo
<p>I have a folder on my server called <code>/assets/includes/updates/</code> with <code>.php</code> files inside featuring static html content.</p>

<p>I'd like to randomly grab a file from this folder and <code>echo</code> it into a div. Here is what I have:</p>

<pre><code>&lt;?php
 function random_update($dir = $_SERVER['DOCUMENT_ROOT'].'/assets/includes/updates/')
{
    $files = glob($dir . '/*.*');
    $file = array_rand($files);
    return $files[$file];
}
?&gt;

&lt;div class="my-div"&gt;
 &lt;?php echo random_update(); ?&gt;
&lt;/div&gt;&lt;!--end my-div--&gt;
</code></pre>

<p>I am getting 500 errors? Also, my intention is to only <code>echo</code> 1 file at a time. Will the provided code accomplish that?</p>
