Thanx guys,
Yes correct, the "n's" are actually line breaks "\n", but if they aren't necessary, I'll omit them.
Escaping the dollarsign in your third example? Your first example (the faulty one) is similar to the third example (the supposedly correct one) you suggest as a possible replacement.
I want the exact, literal string: If ($_SESSION['user'] == 666) { -written to the file, so escaping the dollarsign is the way to go here. Why does this only apply to session variables?
The reason for this way of doing it, is that when an admin whishes to change one or more of the dbconnection parameters from the controlcenter, each line should be an array entry for easy referencing (using file())
One detail: When such a change by the admin occurs, how does it happen physically? Is the whole array rewritten to the file, or only the lines that have been changed? And what would be the name of the array variables? I'm assuming that If you did:
$modify = file(dbconnector.php);
The resulting array would be:
$modify[] = 'first line from file'
$modify[] = 'second line from file'
$modify[] = 'third line from file'
Or what?