Is it possible to store a literal string saying: $_SESSION[user]
in a var?
I tried
$user = "$_SESSION['user']";
But that resulted in an error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)
Then I tried:
$user = "$_SESSION[user]";
If I echo $user
i get a number 19, why?
Why do I need this? Because I'm using fwrite
so I'm creating a new PHP file with an HTML that I already wrote, so my code its something like:
if (isset($_POST['nameofph'])) {
$fname = fopen($_POST['nameofph'].'.php','w+');
fwrite($fname, $fdata);
fclose($fname);
}
I do not know if I explain it well, the point is I need to store that "string" in the var $user
.