Registrating objects with sessions?

From: Date: Mon, 22 Nov 1999 21:51:38 +0000
Subject: Registrating objects with sessions?
Groups: php.version4 
Request: Send a blank email to php-version4+get-6694@lists.php.net to get a copy of this message
Well the following code shows is possible for an array.. is it possible for an object already? it would be great! -----------------------array_register1.php------------------------ <? // trying out if possible to register an array $head = "<head><title>Registering an array</title></head>"; $m1 = "<center><h1> Trying to register an array please recall me </h1></center>"; $m2 = "<p><center><a href = \"array_register1.php\">here</a></center></p>"; $destroy="<h1>session destroyed <a href=\"array_register1.php\">reload</a> if you want to set a session again</h1>"; $add="<p>and if you want to add a new element click <a href= \"array_register1.php?add_new=1\">here</a></p>"; session_start(); if(isset($add_new)){ $index++; $my_array[$index]=0; } if(isset($kill)){ session_unset(); session_destroy(); printf("<html>%s<body>%s</body></html>", $head, $destroy); exit(); } if(!isset($started)){ $index = 0; $my_array[$index] = 0; $started = 0; session_register("my_array"); session_register("started"); session_register("index"); printf("<html>%s<body>%s<br></br>%s</body></html>", $head, $m1, $m2); exit(); } $started++; for ($i = 0; $i < count($my_array); $i++){ $my_array[$i]++; $m3.="<p><center><h3>your_array[$i]: $my_array[$i]</h3></center></p>"; } $m4="<p><center><h3>Session_started: $started</h3></center></p>"; $mkill="<p>to kill session click <a href=\"array_register1.php?kill=1\">here</a></p>"; printf("<html>%s<body>%s<br></br>%s%s%s%s</body></html>", $head, $m1, $m2, $m3, $mkill,$add); ?> --------------------------------------------------------------------------- Saludos Roberto Díaz <rdiazmar@nova.es> http://www.linuxfocus.org/developer/Roberto

« previous php.version4 (#6694) next »