Re: Can Objects be passed to another page?
| From: | Marco Schuler | Date: | Wed, 03 Sep 2003 12:52:35 +0000 |
| Subject: | Re: Can Objects be passed to another page? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161548@lists.php.net to get a copy of this message | ||
Hi
MuToGeN wrote:
> I was saying about GET and POST, not sessions
Could not see that out of your replay... sorry!
--
Cheers!
Marco
> MS> Hi there
>
> MS> MuToGeN wrote:
>
> >> No, arrays can be passed (<input name="array[2]">,
> >> for example), but not objects.
>
> MS> And why does this work then?
>
> MS> === SCRIPT ===
> MS> <?php
>
> MS> error_reporting(E_ALL);
>
> MS> class AClass {
>
> MS> var $i = 0;
>
> MS> function AClass ($i = 0) {
> MS> //$this->display();
> MS> }
>
> MS> function increment() {
> MS> $this->i++;
> MS> }
>
> MS> function display() {
> MS> printf('Current value of $i is: %s<br>', $this->i);
> MS> }
> MS> }
>
> MS> session_start();
>
> MS> if (!isset($_SESSION['AClass'])) {
> MS> $a = & new AClass();
> MS> $_SESSION['AClass'] = & $a;
> MS> }
> MS> else {
> MS> $a = & $_SESSION['AClass'];
> MS> }
>
> $a->>increment();
> $a->>display();
>
> ?>>
>
>
> MS> === /SCRIPT ===
>
>
>
> --
> Best regards,
> MuToGeN mailto:mutogen@pisem.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>