Ok, So, This has been on my nerves for a few days now
The point of this is not too actually write to a file, but while I am testing I have it just writing to a file, later on it will edit a Wordpress page, and some other stuff
First it reads from a file and gets a list of other files, next it opens a file, stores it in an array and should append it to a file, then repeat, adding the contents of each file to the end of the file.
However, all it is doing is taking the contents of the first file and putting that intp the file.
Here is the code, what am I missing? I feel like its right in front of me..
$master = "master.txt";
$mlines = count(file($master));
$mlines = $mlines - 1;
$cat = array();
$files = array();
$ah = fopen($master, 'r');
$temp = fgets($ah);
$cat = explode("=", $temp);
fclose($ah);
for($b = 0; $b <= $mlines; $b++){
$fh = fopen($cat[$b], 'r');
$lines = count(file($cat[$b]));
$lines = $lines - 1;
for($c = 0; $c <= $lines; $c++){
$files[$c] = fgets($fh);
lp_post($files[$c]);
}
fclose($fh);
}
function lp_post($files){
$text = "text.txt";
$h = fopen($text, 'a');
fwrite($h, $files);
fclose($h);
}