-2

Instead of something like this

$objWriter->save('Report.docx');

Can i used to something like this?

$objWriter->save('Report'.$Month,.$Year'.docx');

When i implement the second part, i get an error that says

Parse error: syntax error, unexpected '.'

zed
  • 2,298
  • 4
  • 27
  • 44
Mohd Fadli
  • 143
  • 10

2 Answers2

1

You have a syntax error, you are using a comma right before the string concatenation operator (.), and you are missing another dot (.) after $Year:

$objWriter->save('Report'.$Month,.$Year'.docx');

Change it to:

$objWriter->save('Report'.$Month.$Year.'.docx');

The posted answer also solves the problem, which is fine. Use whatever you like best, there are subtle differences between using single quotation (') vs double quotation ("), but in this case it shouldn't matter much.

ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
-1

Found the answer.

 $objWriter->save("Report $Month $Year.docx");
Mohd Fadli
  • 143
  • 10