document.write('<div class="php" style="font-family: monospace;"><span style="color: #0000ff;">$d</span> = <a target="_blank"&nbsp; href="http://www.php.net/dir"><span style="color: #000066;">dir</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">\'plugins\'</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('<span style="color: #0000ff;">$somevar</span> = <span style="color: #ff0000;">&quot;yaay, it works!&quot;</span>;<br />');
document.write('<br />');
document.write('<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$entry</span> = <span style="color: #0000ff;">$d</span>-&gt;<span style="color: #006600;">read</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// make sure the file isn\'t the current dir or the parent dir</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$entry</span> != <span style="color: #ff0000;">&quot;.&quot;</span> &amp;&amp; <span style="color: #0000ff;">$entry</span> != <span style="color: #ff0000;">&quot;..&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// get the class name from the file name</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$class</span> = <a target="_blank"&nbsp; href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.php&quot;</span>, <span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// include the plugin</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">include</span> <span style="color: #ff0000;">\'plugins/\'</span> . <span style="color: #0000ff;">$entry</span>;<br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$instance</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0000ff;">$class</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// now we can call anything in that class if it exists!</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$instance</span>-&gt;<span style="color: #006600;">invokeSomething</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$somevar</span><span style="color: #66cc66;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />');
document.write('<span style="color: #66cc66;">&#125;</span></div>');
document.write('<br />&nbsp;<br /><div style="font-size: 12px">Brought to you by the community at <a href="http://www.bytemycode.com/snippets/snippet/444/1/" target="_blank">byteMyCode</a>.</div>');
