Re: [PHP4BETA] Sessions and Objects

[email protected] (Andrei Zmievski)
Newsgroups php.version4
Message-ID <[email protected]>
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. *
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.