Home > Software engineering >  SQL Statment Includes ${$variable}, Not Sure What It Does
SQL Statment Includes ${$variable}, Not Sure What It Does

Time:07-26

I'm updating an old web application to PHP 7.4 and PDO. I found something in an SQL statement that I've not seen before and I can't find anything on the web (maybe just not sure how to ask the question). Database is MySQL.

UPDATE location_info SET storeid = ${$locationid} WHERE...

Can someone explain the use of the ${} around the PHP variable?

CodePudding user response:

String interpolation

You can read it at :

https://riptutorial.com/php/example/22788/string-interpolation

https://phppot.com/php/variable-interpolation-in-php/

But that syntax has been deprecated in PHP 8.2, and will removed in PHP 9.0 :

https://php.watch/versions/8.2/${var}-string-interpolation-deprecated

  • Related