Jump to content

[SOLVED] variables variable


dennismonsewicz

Recommended Posts

In what sense?

 

Are you referring to the $$ command?

 

Really this should not be used, but here is an example:

<?php
$varname = "var1";
$var1 = "bob";
echo $$varname;
?>

 

The above should echo "bob", however this is why we have arrays...

<?php
$varname = array("var1" => "bob");
echo $varname["var1"];
?>

 

Same logic.

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.