note 3714 deleted from language.variables by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 18:46:32 +0000 |
| Subject: | note 3714 deleted from language.variables by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25172@lists.php.net to get a copy of this message | ||
Hi, boys and girls... are we ready for stupid PHP tricks? Try the following rather neat aspect of
objects (note that the script that you unserialize the object in my have the original class defined,
but you can pass it off like any other string, like hidden tags in forms, or stored in a mySQL
database):
<pre>
Testing some PHP internals:
<hr>
<?
class foo
{
var $bar;
function foo()
{
$this->bar=5;
}
function write()
{
echo $this->bar;
}
}
$ni = new foo;
$ni->write();
echo "<hr>";
$herring = serialize($ni);
echo $herring;
echo "<hr>";
$knight=unserialize($herring);
$knight->write();
?>
</pre>