Encapsulating Complex Data Types : unserialize « Utility Function « PHP






Encapsulating Complex Data Types

 
<?php 
$fruits = array('apple', 'orange', 'apple'); 

$str = serialize($fruits); 
echo "$str\n"; 

$new_fruits = unserialize($str); 
$new_fruits[] = 'apple'; 
print_r($new_fruits); 
?>
  
  








Related examples in the same category

1.convert the string produced by serialize() back into an object with the unserialize() function.
2.Serialize and unserialize array