Serialize and unserialize

Views: 18 Last modified: August 03rd, 2011 Comments: 0

This is a simple and basic example of how to serialize and unserialize a variable, or in this case an array.

<?php
// Serialize
$ser = serialize(array('php', 'aspx', 'java'));

// Unserialize
$unser = unserialize($ser);

// Print the unserialized
print_r($unser);
?>
Array (
[0] => php
[1] => aspx
[2] => java
)
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

    Mail this!

    To: From:Sum {1+2} =  
    Anything to add ?

        You must be logged in to post a comment.