convert the string produced by serialize() back into an object with the unserialize() function. : unserialize « Utility Function « PHP






convert the string produced by serialize() back into an object with the unserialize() function.

 
<?
class apple {
  var $flavor="sweet";
}
$app = new apple();
$stored = serialize( $app );
print $stored;

$new_app = unserialize( $stored );
print $new_app->flavor;
?>
  
  








Related examples in the same category

1.Encapsulating Complex Data Types
2.Serialize and unserialize array