soulreaping
New Member
- Reaction score
- 17
With PHP, is there a way to store a class instance in a MySQL database?
With PHP, is there a way to store a class instance in a MySQL database?
<?php
class Test
{
function __construct($a, $b)
{
$this->a = $a;
$this->b = $b;
}
private $a;
private $b;
}
$t = new Test(1, 2);
print_r($t);
print_r(unserialize(serialize($t)));
?>
Test Object
(
[a:private] => 1
[b:private] => 2
)
Test Object
(
[a:private] => 1
[b:private] => 2
)