note 7779 modified in language.variables.variable by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 18:54:36 +0000 |
| Subject: | note 7779 modified in language.variables.variable by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25202@lists.php.net to get a copy of this message | ||
here's a workaround which i've found useful when trying to assign values to variable
variables within functions, (which, needless to say, seems to be buggy)
function altervar() { #sets $bob[1]='whatever';
$var='bob';
global $$var;
$temp=$$var;
$temp[1]='whatever';
$$var=$temp;
}
if you try to alter $$var[1] directly it doesn't work, even though it's globaled.
--was--
<pre>
here's a workaround which i've found useful when trying to assign values to variable
variables within functions, (which, needless to say, seems to be buggy)
function altervar() { #sets $bob[1]='whatever';
$var='bob';
global $$var;
$temp=$$var;
$temp[1]='whatever';
$$var=$temp;
}
if you try to alter $$var[1] directly it doesn't work, even though it's globaled.
</pre>
http://www.php.net/manual/en/language.variables.variable.php