Interpolation

php.internals

[ ]

5 years ago
Wouldn't you like to have adequate interpolation in php? ``` $index = 12345; const SOMETHING = 333; function number() { return 888; } echo "this is a ${{ number() + 123 * $index + SOMETHING }} string"; ```

Rowan Collins

5 years ago
On 24/09/2020 19:59, qu3s710n wrote:
> Wouldn't you like to have adequate interpolation in php? > > ``` > $index = 12345; > const SOMETHING = 333; > > function number() { > return 888; > } > echo "this is a ${{ number() + 123 * $index + SOMETHING }} string"; > ``` >
Personally, I find the interpolation we have "adequate", but you're not alone in thinking that a more powerful feature would be nice. Have a look at this recent thread for some of the possibilities and problems: https://externals.io/message/111519 As a general note, though, it's best to broach new topics with a bit more thought than this - being able to say "I've looked into improving X, and it seems possible that it could work like Y, with possible problem Z; should I pursue the idea?" is going to get a more favourable reaction than just "wouldn't you like X?". Regards,
-- Rowan Tommins (né Collins) [IMSoP]