Re: [PHP4BETA] Sessions and Objects

From: Date: Fri, 19 May 2000 15:12:08 +0000
Subject: Re: [PHP4BETA] Sessions and Objects
References: 1 2 3  Groups: php.version4 
Request: Send a blank email to php-version4+get-15245@lists.php.net to get a copy of this message
On Fri, 19 May 2000, Dave wrote: > I tried your example Andrei and the methods are not available, however the > properties are and retain the value of $a->b > > <? // Page 1 > # save session > include "foo.class.php"; > session_start(); > session_register("a"); > $a = new foo; > $a->b = 10; > ?><a href=page2.php>Page 2</a> > > <? // Page 2 > # restore session > include "foo.class.php"; > session_start(); > var_dump($a); > ?><br><a href=page1.php>Page 1</a> > <? $a->p(); ?> // This prints Call to undefined function: p() in.... > > > <? // foo.class.php > class foo { > var $a; > var $b; > var $c; > function foo() { > echo "foo()<BR>\n";flush(); > $this->a = 1; > $this->b = "a"; > $this->c = array("hallo"); > } > function p() { > echo $this->a." ".strlen($this->b)." > ".count($this->c)."<BR>\n"; > $this->a++; > $this->b.="a"; > $this->c[]="hallo"; > } > } > ?> I don't know, Dave, I copied this example verbatim and tried it on RC2-dev version and it worked... Are you sure you are using latest RC2? -Andrei * There is no knowledge that is not power. *

« previous php.version4 (#15245) next »