Is it possible to have php load and run javscript?
<p>I have a php script that runs glob on a directory, and it returns all the images it finds in the directory, with an ad from google before all the images.
I would like it if I could use glob to load 10 of the images, then insert the javascript from googles ad services, and continue loading the images. So an ad every 10 images. Every attempt by me so far has failed spectacularly, and any help would be greatly appreciated!</p>

<p>Below is my PHP code</p>

<pre><code>&lt;?php
$manualwidth = $_GET['manwidth'];
$manualdir = $_GET['mandir'];
$manualmodel = $_GET['manurl'];
$manualurl = $manualdir . '/' . $manualmodel . '/';
$files = glob($manualurl .'{*.jpg,*.gif}', GLOB_BRACE);

for ($i=0; $i&lt;count($files); $i++)


{
    $num = $files[$i];
    echo '&lt;img src="'.$num.'" width="'.$manualwidth.'"&gt;&lt;br&gt;'."&amp;nbsp;&amp;nbsp;";
    }
?&gt;
</code></pre>
