${expression} is deprecated¶
The $\{} allowed the usage of an expression to be used as the name of a variable, inside de double quoted string. This feature was largely unknown and unused, so it is removed.
PHP code¶
<?php
$foo = 'bar';
$bar = 'xyz';
var_dump("foo is ${$foo}");
?>
Before¶
string(10) "foo is xyz"
After¶
PHP Deprecated: Using (variable variables) in strings is deprecated, use {} instead
Deprecated: Using (variable variables) in strings is deprecated, use {} instead
string(10) "foo is xyz" b
PHP version change¶
This behavior changed in 8.2