note 7779 added to Variable variables

From: Date: Tue, 15 Aug 2000 10:42:50 +0000
Subject: note 7779 added to Variable variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-1891@lists.php.net to get a copy of this message
<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/language.variables.variable.php

« previous php.notes (#1891) next »