RE: [PHP-WIN] global variables & classes

From: Date: Sun, 29 Oct 2000 11:28:31 +0000
Subject: RE: [PHP-WIN] global variables & classes
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3576@lists.php.net to get a copy of this message
Try it this way. function display() // one of the class member functions // { global $priorities; // needed to scope global to function print("$priorities[1]"); // use brackets // } -----Original Message----- From: John Timor [mailto:john@supertimor.net] Sent: Sunday, October 29, 2000 11:32 AM To: PHP Windows Subject: [PHP-WIN] global variables & classes 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 (#3576) next »