Re: class Problem

From: Date: Tue, 17 Sep 2002 12:04:01 +0000
Subject: Re: class Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-116617@lists.php.net to get a copy of this message
Hi, when you want to access class member variables prefix them with $this-> , otherwise they will be treated as local vars. hope that helps. Elias "David Eggler" <david@eggler.at> wrote in message news:Xns928C7E2C3629Adavidegglerat@216.92.131.4... > I create a Instance fo the Class MenueItem in Menue. I change the value of > one of its variables. But when i call the function within MenueItem there > seems not to be a value: > The intresting thing is it works with Other variables, even i cant echo > them, they have a value.... > > Thanks for help > > class Menue { > > function Makechilde($somvalue) { > echo "Next_ID: " . $Parent_ID . "<BR>"; //Works > $MI->Parent_ID = $Parent_ID; > echo "Parent_ID: " . $MI->Parent_ID . "<BR>";//correct output > $MI->write(); > > } > } > > class MenueItem { > var $ID_Menue; > var $Name; > var $Parent_ID; > var $Next_ID; > var $Prev_ID; > > > function Write() { > echo "Parent_ID: " . $MI->Parent_ID . "<BR>"; > //(no output at all!) > } > > } >

« previous php.general (#116617) next »