+ 1

What is meant by "Variable Variable"?

Not certain I'm understanding this lesson's instruction. It begins: "Variable Variables With PHP, you can use one variable to specify another variable's name. So, a variable variable treats the value of another variable as its name." In the header, is the use of "Variable Variables" a typo? If not, what is meant by it? In sentence two under the header, is "variable variable" a typo? If not, what is meant by it?

29th Nov 2020, 10:47 PM
EO4Wellness
EO4Wellness - avatar
3 Antworten
+ 3
This is actually a very versatile feature of PHP. It allows for the value of one variable to be used as the name to call another variable. Say you had several functions and wanted to call a specific one depending on user input. Instead of having a menu where the user entered some arbitrary value for a choice they could actually just type in the name of the function they wanted to call. This could be held in a variable and then called by using the double dollar sign $
30th Nov 2020, 1:21 AM
ChaoticDawg
ChaoticDawg - avatar
+ 6
It's the official name of the feature: https://www.php.net/manual/en/language.variables.variable.php I think "variable variable names" could make it clearer
30th Nov 2020, 12:05 AM
Kevin ★
+ 3
I don't know if that could be a typo, I guess the use of term "variable variable" was meant to keep the lesson title rather short. I couldn't find better words to describe the topic myself. So for this case, I prefer to just understand the topic, and not minding the lesson title much. You can directly ask SoloLearn about this still, by sending an e-mail to info@sololearn.com for a firmed explanation 👍
29th Nov 2020, 11:36 PM
Ipang