DEV Community

Discussion on: Write good PHP - string management

Collapse
 
deta19 profile image
mihai

i accept your oppionion partialy. i thinks its better to use concatenation because it will make your strings morereadble. I know you prefer the double quotes, but if concatenation doesn;t effect the execution time, i prefer concateations because, in my opinion is easier to read, the variables pop up and i think its easier to debug because you 're sure the error comes from the variable and not a execution problem on the string part, those double quotes. Also junior devs will realise faster that you concatenate variable values to the string.
those are my 2cents

Collapse
 
joemoses33 profile image
Joe 🏴󠁧󠁢󠁷󠁬󠁳󠁿

I get your points!

I'd imagine the execution difference is absolutely trivial!

Concat is 8-11ms, whereas interpolation is 7-10. Definitely not a deciding factor, imo!

I think it comes down to personal preference! Though, for Jr Devs, I think we should always encourage them to learn and use (objectively and subjectively) clearer syntax.