using "serialize" might work

----- Original Message ----- 
From: "Marco Schuler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 03, 2003 3:37 PM
Subject: Re: [PHP] Can Objects be passed to another page?


> Hi there
> 
> MuToGeN wrote:
> 
> > No, arrays can be passed (<input name="array[2]">,
> > for example), but not objects.
> 
> And why does this work then?
> 
> === SCRIPT ===
> <?php
> 
> error_reporting(E_ALL);
> 
> class AClass {
> 
>     var $i = 0;
> 
>     function AClass ($i = 0) {
>         //$this->display();
>     }
> 
>     function increment() {
>         $this->i++;
>     }
> 
>     function display() {
>         printf('Current value of $i is:  %s<br>', $this->i);
>     }
> }
> 
> session_start();
> 
> if (!isset($_SESSION['AClass'])) {
>     $a = & new AClass();
>     $_SESSION['AClass'] = & $a;
> }
> else {
>     $a = & $_SESSION['AClass'];
> }
> 
> $a->increment();
> $a->display();
> 
> ?>
> 
> 
> === /SCRIPT ===
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to