Re: global variables & classes

From: Date: Sun, 29 Oct 2000 23:06:14 +0000
Subject: Re: global variables & classes
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3581@lists.php.net to get a copy of this message
In the function display(), try to call $priorities this way: $this->priorities > Hi ... > I'm new to php, and I have a little problem : > > I declare an array in the main body of my script, I define a class which > includes a function from where I would like to reffer to this array ... but > I can't manage to access it :( > > Here is the code used : > > <? > $priorities = array( > 1 => "very low", > 2 => "low", > 3 => "normal", > 4 => "high", > 5 => "very high", > ); // my array // > > class task > { > // ... // > function display() // one of the class member functions // > { > echo $priorities(3); // does not echo anything :( // > } > } > > $test = new task; > $test->display(); > ?> > > Thanks for help. > John. > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.windows (#3581) next »