Jump to content

problem with variables


Porl123

Recommended Posts

How would I output the value of a variable, getting the name from the value of another variable? For example:

 

$var1 = 'var2';$var2 = 'output';

 

 

I want it to return 'output', which I'd imagine would work through entering something along lines of $$var1;

Does anyone know what I mean?

Link to comment
https://forums.phpfreaks.com/topic/213725-problem-with-variables/
Share on other sites

You will find that in almost every case, using an array will result in simpler code. It will be faster too, because setting or referencing a variable using a variable variable is three times slower than using an array variable directly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.