Is this a bug ?

From: Date: Mon, 05 Feb 2001 13:59:39 +0000
Subject: Is this a bug ?
Groups: php.general 
Request: Send a blank email to php-general+get-38229@lists.php.net to get a copy of this message
Hello, when I use this syntax: champs[0] is a string, which is the name of an HTML form variable. class test {
      var champs;
          function verif()
              {
                  for ($i = 0; $i < count($this->champs) ; $i++)
                      {
                          global $$this->champs[$i][0];
                          $tmp = $this->champs[$i][0];
                          $this->champs[$i][1] = $$tmp;
                      }
              }
} Everything works properly, but when I use this : class test {
      var champs;
          function verif()
              {
                  for ($i = 0; $i < count($this->champs) ; $i++)
                      {
                           global $$this->champs[$i][0];
                           $this->champs[$i][1] = $$this->champs[$i][0];
                      }
              }
} It doesn't work ($this->champs[$i][1] is empty). My problem is : why is the global instruction working whereas the newt line isn't with this formulation (I have to use a temporary variable which I then can reference). Thanx for any help, and apologize my poor English. S. ROZIER

« previous php.general (#38229) next »