You can allso do this:
//foo.class.php
class Foo{
var $bar;
function Foo($bar){
$this->bar = $bar;
}
}
//foo.php
include("foo.class.php");
$bar = "1234";
$foo = new Foo($bar);
//Now: $foo->bar = "1234"
Regards: Marcus Rasmussen
*********** REPLY SEPARATOR ***********
On 14-02-2001 at 15:52 Joseph H Blythe wrote:
>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
>
>--
>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]
--
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]