Working with fpdf, having the problem that I want the filename to be the time now in hours, minutes, and seconds.
$timezone = "Europe/Oslo";
date_default_timezone_set($timezone);
$format="%H%M%S";
$strf=strftime($format);
Having the problem how to put the variable with the .pdf. Because this way didn't work:
$pdf->Output('$strf.pdf', 'D');
Variables must be wrapped in double quotes, or else PHP will output them literally ($strf.pdf
rather than 123456.pdf
).
$pdf->Output("$strf.pdf", 'D');
or $pdf->Output($strf . '.pdf', 'D');
I personally prefer the second, since I think it is easier to read and comprehend. I only use variables in double-quoted strings when it is a very long string with multiple variables and concatenating strings and variables can get messy.