Hi! Just a quick question - Is there any way of setting which line is written to with the ‘fopen’ statement? I currently have:

$file=fopen(“example3.xml”, “a”);
fwrite($file, $str);

which obviously writes $str to the end of $file, but Im wanting to write it to the second line in the file.



I think you’re going to have to read the full contents of your file and do some string magic in PHP in order to achieve that. Think substr() and strpos() and stuff like that.