Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to use echo’s commas instead of string concatenation

I don't know what I'm doing wrong here, but I'm getting parse error: "Parse error: syntax error, unexpected ',' in..."

$msg= 'This is ', htmlentities($from, ENT_QUOTES, 'UTF-8'),' and ', htmlentities($to, ENT_QUOTES, 'UTF-8'),' dates statistic ';
echo $msg;

Can you help me? I don't want to use concatenation, because of slower speed.

like image 800
Christine Avatar asked Dec 28 '22 15:12

Christine


1 Answers

Basicaly commas seperated values are arguments. You are trying to pass arguments to the variable but not echo!

echo 'This is ',
  htmlentities($from, ENT_QUOTES, 'UTF-8'),
  ' and ',
  htmlentities($to, ENT_QUOTES, 'UTF-8'),
  ' dates statistic ';
like image 153
Anpher Avatar answered Dec 30 '22 05:12

Anpher