Im new to php and I'm just trying stuff out, and I was wondering if i could take text from one file then put it into another.
For example have a .txt file that contains :
<?php
echo "Hello World";
?>
but then have a script run that takes that text and puts it into a new .php file.
When you have php code in that file you also could just use:
Include 'example.php';
If I understand you correctly, what are you trying to achive is copying a content of a text file to a php file.
Simpliest way to do it:
<?php
$sourceFile = 'example.txt';
$destinyFile = 'example.php';
if (copy($sourceFile, $destinyFile))
echo "DONE";