Home >Backend Development >PHP Tutorial >How Can I Deserialize a Serialized String in PHP?
Understanding Serialization and Unserialization
You've encountered a serialized string, which is represented as follows:
a:2:{i:0;s:7:"Abogado";i:1;s:7:"Notario";}
To retrieve the array stored within this string, you must perform deserialization using the unserialize() function:
$str = 'a:2:{i:0;s:7:"Abogado";i:1;s:7:"Notario";}'; print_r(unserialize($str));
This operation will produce the following output:
Array ( [0] => Abogado [1] => Notario )
Manual Notes:
The above is the detailed content of How Can I Deserialize a Serialized String in PHP?. For more information, please follow other related articles on the PHP Chinese website!