How to interpolate variables in strings in JavaScript, without concatenation?

You can take advantage of Template Literals and use this syntax: Template literals are enclosed by the back-tick (` `) (grave accent) instead of double or single quotes. This feature has been introduced in ES2015 (ES6). Example How neat is that? Bonus: It also allows for multi-line strings in javascript without escaping, which is great for templates: Browser support: … Read more

PHP – how to create a newline character?

Only double quoted strings interpret the escape sequences \r and \n as ‘0x0D’ and ‘0x0A’ respectively, so you want: Single quoted strings, on the other hand, only know the escape sequences \\ and \’. So unless you concatenate the single quoted string with a line break generated elsewhere (e. g., using double quoted string “\r\n” or using chr function chr(0x0D).chr(0x0A)), the only other way to have a line break … Read more

PowerShell string interpolation syntax

To complement marsze’s helpful answer: ${…} (enclosing the variable name in { and }) is indeed always necessary if a variable name contains special characters, such as spaces, ., or -. Not special are _ and – surprisingly and problematically – ?. Note: : is invariably interpreted as terminating a PowerShell drive reference, in the context of namespace variable notation, irrespective of whether {…} enclosure is used or required (e.g., in $env:USERNAME or ${env:USERNAME}, env refers to the PowerShell drive representing all environment variables). In the context … Read more