![]() |
|
|
+ Search |
![]()
|
Jan 16th, 2000 21:29
Nathan Wallace, Marc-Olivier Krahenbuhl,
A variable variable allows you to have a variable name that is set at
run time. This can be implemented as follows:
<?php
// Set the variable name
$var_name = 'myvariable';
// Now you can access the variable $myvariable with
$$var_name = 1;
// So this will always work
if ($$var_name == $myvariable) {
echo "This will always be true since they are the same thing";
}
?>