From my PHP program I write to file. During that writing I need to include the text of several other files.
At the moment the code looks something like:
fwrite($myfile, "a lot of text");
$fp = fopen("include1.txt", "r");
$data = fread($fp, 100000);
fclose($fp);
fwrite($myfile, "$data");
fwrite($myfile, "a lot more text");
$fp = fopen("include2.txt", "r");
etc.
etc.
Now I think that there must be a smarter way. I found functions like file(), readfile() and fpassthru(). They come close, but they can't do what I want.
Does anyone know a solution for this?
Thanks,
Wim