 <p>If I understood well, you would like include the code from <code>includefile.php</code> into your test.php ?</p> <p>You can't use include like that, but you should do it like that.</p> <pre><code>file_put_contents($file, file_get_contents('includefile.php'), FILE_APPEND); </code></pre> <p>This will append the content from <code>includefile.php</code> into your <code>test.php</code></p>