xoxox xoxox - 9 months ago 53
PHP Question

How can I insert a value into a string without concatenation?

My goal is to insert a variable's value directly into a string without concatenation using the


I tried like this:

$filename = 'some_file_name';
header('Content-disposition: attachment; filename=$filename');

But this gives me
, not

How do I achieve this? What am I missing?

Answer Source
$filename = "path/to/file.txt";
header("Content-disposition: attachment; filename=$filename");