How do I copy one PHP script into another?
<p>I am new to PHP, so I have a basic question.</p>

<p>I have this php script called hello.php. Basically I want to create a new php script exactly the same as <code>hello.php</code>, but with a unique name.</p>

<p>This is what I am thinking of doing, please tell me if it is in in the right direction.</p>

<pre><code>$temp = tempnam(directory, prefix).'.php';
</code></pre>

<p>This creates a unique name, and appends .php to it so it will be a php file. 
How do I write the content of hello.php into <code>$temp</code>? I'm familiar with fwrite to write strings into the file, but what about writing all the codes from a different file, such as <code>hello.php</code>?</p>

<p>Thank you.</p>
