My code has to be:
$name = 'Pete';
$name2 = 'Jones';
$data = "$x['$name'] = '$name2';";
$x
shouldn’t be changed to the value of $x, but just remain $x. $name, does have to change to Pete and $name2 has to change to Jones. How can I write the line $data without having errors?
Thanks!
Escape the
$:See http://php.net/manual/en/language.types.string.php#language.types.string.parsing.