PHP unserialize() Function

P
PHP unset() Function
PHP strval() Function

In this article, you will learn how to convert serialised data into original data. The unserialize() function in PHP converts serialized data back into actual data.

what is the syntax of the UNSERIALIZE() function in php?

unserialize(string, options);
ParametersDetails
stringRequired. Specifies the serialized string
optionsOptional. Specifies options to be provided to the function, as an associative array. Can be either an array of class names which should be accepted, false to accept no classes, or true to accept all classes. True is default.
PHP UNSERIALIZE() method

examples of the UNSERIALIZE() function

Example 1. In this example, we convert serialized data back into actual data.

<?php
$data = serialize(array("Red", "Green", "Blue"));
echo $data . "<br>";

$test = unserialize($data);
var_dump($test);
?>
PHP unset() Function
PHP strval() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z