Re: help with classes

From: Date: Wed, 14 Feb 2001 05:22:51 +0000
Subject: Re: help with classes
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-39349@lists.php.net to get a copy of this message
On Mon, 12 Feb 2001 21:04:30 -0800 Joe wrote: JC> Is this closer to what you were looking for? JC> - Joe JC> JC> <?PHP JC> JC> class Foo { JC> JC> var $bar; JC> JC> function mymethod(){ JC> JC> global $foo; JC> $this->bar = $foo; JC> JC> } JC> JC> } JC> JC> $foo = "hello world"; JC> JC> echo "<html><body>"; JC> JC> $cls = new foo(); JC> $cls->mymethod(); JC> echo $cls->bar; JC> JC> echo "</body></html>"; JC> ?> JC> hmm sort of is, basically this works: // Foo.class.php class Foo { var $bar; setBar($bar) { $this->bar = $bar; } } // foo.php include("Foo.class.php"); $foo = new Foo; $bar = "1234567789"; $foo->setBar($bar); Regards, Joseph

« previous php.general (#39349) next »