Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead¶
Description¶
The interpolation syntax ${expression}
is deprecated. It takes an expression (here, a concatenation) to build the name of the variable that is used in the end. It is recommended to update the syntax with a compatible one or use concatenation, before the syntax is removed.
Example¶
<?php
$foo = 'bar';
$bar = 'xyz';
var_dump("foo is $\{$foo}");
?>
Solutions¶
Use
{}
instead.Use concatenation instead.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See dollar_curly_expression.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See dollar_curly_expression.