[PHP] Is this a bug ?

2001-02-05 Thread Sébastien ROZIER

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is this a bug ?

2001-02-05 Thread Sébastien ROZIER

OK sorry, I did put the "$", and adding = array() is still not working
Thanx for any help

Steve Werby wrote:

 "Sbastien ROZIER" [EMAIL PROTECTED] wrote:
 
 when I use this syntax:
 champs[0] is a string, which is the name of an HTML form variable.
 
 class test
{
var champs;
 
 
 When initiating a variable you need to prefix it with "$". So the line above
 should be:
 
 var $champs;
 
 If it's an array you may want to initiate it like:
 
 var $champs = array();
 
 I don't have the time to analyze your code in full right now, but hopefully
 this will get you started.
 
 --
 Steve Werby
 COO
 24-7 Computer Services, LLC
 Tel: 804.817.2470
 http://www.247computing.com/
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]