Cannot an array variable be included in a string assigned with double quotation marks ??? I have a statement written like this: PHPcode $ str = & quot; ($ value ['title'], $ value ['artiste '], $ value ['alipay'], $ value ['by'], $ value ['lrc '], $ timeSt, which is a string assigned with double quotation marks, cannot contain array variables ???
I have a statement written like this:
PHP code
$ Str = "($ value ['title'], $ value ['artiste '], $ value ['alipay'], $ value ['by'], $ value ['lrc '], $ timeStamp, $ timeStamp ),";
Error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Which of the following variables must be separated and written in double quotes? Cannot include this?
Thank you!
------ Solution --------------------
Do it like this
PHP code
$ Str = "({$ value ['title']}, {$ value ['artiste ']}, {$ value ['alipay']}, {$ value ['by']}, {$ value ['lrc ']}, $ timeStamp, $ timeStamp ),";