Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the proper term for converting a string into a variable/class/method?

Tags:

php

I know it sounds so dumb but people were asking me about it and I don't have a proper answer.

Like

$var = "var1";
$var1 = "hello";

echo $$var;

Thanks!

like image 712
Loreto Gabawa Jr. Avatar asked Apr 07 '26 07:04

Loreto Gabawa Jr.


2 Answers

You are talking about Variable variables :)

like image 88
Sarfraz Avatar answered Apr 08 '26 19:04

Sarfraz


They're called variable variables.

like image 31
Sebastian Paaske Tørholm Avatar answered Apr 08 '26 19:04

Sebastian Paaske Tørholm