Single quotes or double quotes for variable concatenation?

Viewed 55553

Is it better to concatenate a variable (say, $name) into an existing string (say, $string) like this:

$string='Hi, my name is '.$name

or to embed the variable in the string like this:

$string="Hi, my name is $name";

or is it better to use a function like this:

$string=sprintf("Hi, my name is %s",$name);

Which is better in terms of processor time/efficiency?

10 Answers
Related