-1

In JavaScript, you can do this:

console.log(`Hello ${3 + 4} World.`)

The out put will be Hello 7 World. I can do the same in C# with Console.WriteLine($"Hello {3 + 4} World").

In PHP I tried:

echo "Hello {3 + 4} World."

However the output of this is Hello {3 + 4} World.

How do I interpolate expressions in strings in PHP?

Perkunas
  • 7
  • 3
  • 1
    Does this answer your question? [PHP string interpolation syntax](https://stackoverflow.com/questions/43437121/php-string-interpolation-syntax) – nice_dev Jan 15 '22 at 16:10
  • hm not really unless you are saying it's simply not possible in PHP? – Perkunas Jan 15 '22 at 19:58

1 Answers1

0

You can use this : echo "Hello ".(3+4)." World.";

John
  • 578
  • 1
  • 3
  • 15