${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 in /codes/dollar_curly_expression.php on line 5

Deprecated: Using  (variable variables) in strings is deprecated, use {} instead in /codes/dollar_curly_expression.php on line 5
string(10) foo is xyz

PHP version change

This behavior changed in 8.2

Error Messages