2

I am getting a "Parse error: syntax error, unexpected 'echo' (T_ECHO)" whenever i try and echo another variable inside a variable like this:

$content=. '<p>Paragraph '.echo $variable.' here</p> ';
Pistone Sanjama
  • 489
  • 1
  • 4
  • 14
  • 1
    Remove the echo. Echo is to send it to the screen, and what you're trying to attempt here is concatenate a string into a variable. – aynber Jul 23 '20 at 14:31

1 Answers1

4
$content .= '<p>Paragraph '.$variable.' here</p> ';
echo $content;

It should be like this. (.) dot should be before = and echo should not be inside the content

Chilarai
  • 1,842
  • 2
  • 15
  • 33