Re: Can Objects be passed to another page?

From: Date: Wed, 03 Sep 2003 14:23:46 +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-161557@lists.php.net to get a copy of this message
Radu Manole wrote: > using "serialize" might work The script works as it is quoted in my previous message. P.S.: It is sufficient to post your replay to the list. Thank you! -- Marco > > ----- Original Message ----- > From: "Marco Schuler" <marco.schuler@scopein.ch> > To: <php-general@lists.php.net> > 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 >

« previous php.general (#161557) next »