-1

Hi guys I am trying to get the following code below to work but I got a parse error: syntax error, unexpected '"'

$product .= "$item_id-""$length-""$Category-".$each_item['quantity'].","; 

Basically it is meant to show something like this. 1-12 size-blue-13 the ","

1
  • you forgot to add a dot between "$item_id-" and "$length-" and also "$length-" and "$Category-" try this: $product .= "$item_id-"."$length-"."$Category-".$each_item['quantity'].","; Commented Aug 4, 2013 at 20:01

2 Answers 2

2

With strings you can use braces:

$product .= "${item_id}-${length}-${Category}-${each_item['quantity']},"; 
Sign up to request clarification or add additional context in comments.

Comments

0

PHP variable interpolation vs concatenation


The correct syntax - $product .= "${item_id}-"."${length}-"."${Category}-".$each_item['quantity'].",";

4 Comments

Thanks love, unbelievable what . can mean,lol
Please mark it as the answer or upvote if it is correct.
4 minutes until i can mark

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.