Hongmu Notes
Home Language Notes PHP unserialize function
Language Notes PHP

PHP unserialize function

PHP unserialize function

The `unserialize()` function is used to deserialize objects or arrays that have been serialized using the `serialize()` function, and it returns the original object structure.

return value

Returns the converted value, which can be an integer, float, string, array, or object.

If the passed string cannot be deserialized, the function returns FALSE and generates an E_NOTICE.

<?php
$str = 'a:3:{i:0;s:6:"Google";i:1;s:6:"Runoob";i:2;s:8:"Facebook";}';
$unserialized_data = unserialize($str);
print_r($unserialized_data);
?>

The output is:

Array
(
    [0] => Google
    [1] => Runoob
    [2] => Facebook
)

 

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

PHP ob function record

PHP ob function record Language Notes PHP

Usage of the following three functions ob_get_contents(); ob_end_clean(); ob_start(); You can use these functions to buffer local files and execute local script code. Use ob_start() to save the output code into the buffer, and the page will not be displayed; then use ob_get_contents to get the data in the buffer. o…
👁 141
PHP preg

PHP preg Language Notes PHP

The preg_match_all function is used to perform a global regular expression match. preg_match_all() Syntax int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG…
👁 169
Detailed explanation of PHP ternary operator and if

Detailed explanation of PHP ternary operator and if Language Notes PHP

Ternary operator condition ? Result 1 : Result 2 Explanation: The position in front of the question mark is the condition for judgment. If the condition is met, the result is 1, and if it is not met, the result is 2. This article compares and explains the ternary operator and if...else... in detail. I hope it will be helpful to everyone. Today when I was revising my paper online, I encountered a statement that I couldn’t understand: $if_summary = $row['IF_SUMMARY']=…
👁 189
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232

Recommended reading

(PC + WAP) pbootCMS Metal Materials Website Template – Download Source Code for a Steel Sheet Processing Website (Version 0807)

(PC + WAP) pbootCMS Metal Materials Website Template – Download Source Code for a Steel Sheet Processing Website (Version 0807) Practical Collection pbootcms Template

A PbootCMS blue website template designed for processing metal materials and steel sheets, compatible with both PC and WAP devices. The professional industrial design style is ideal for showcasing metal material specifications, processing services, and industrial applications. This template helps metal material companies demonstrate their product capabilities online and attract industrial clients. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5...
👁 31
Food & Catering Snack Website Template 0513

Food & Catering Snack Website Template 0513 Practical Collection Yiyou template

This set of eyoucms templates is suitable for comprehensive websites of food, catering and snacks. The design style is delicious and can display food and catering brands, specialty snacks, store images and franchise information. It helps catering and food brands attract consumers and franchisees online. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Yiyou CMS installation Yiyou C...
👁 61
(Adaptive Mobile) Responsive Electronic Products – PBootCMS Website Template; Download HTML5 Electronic Components Website Source Code – 0808

(Adaptive Mobile) Responsive Electronic Products – PBootCMS Website Template; Download HTML5 Electronic Components Website Source Code – 0808 Practical Collection pbootcms Template

A responsive electronic product and component website template compatible with mobile devices. Featuring a modern, tech-driven design, this template is ideal for electronic component manufacturers or electronics brands to showcase their product lines. It helps electronics companies demonstrate their technical expertise online and attract customers. Template Overview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 49
Wood-grain flooring & wall tile website template – 0514

Wood-grain flooring & wall tile website template – 0514 Practical Collection Yiyou template

An eYouCMS website template designed for the wood-grain flooring and wall tile industries. Its modern home decoration design style is ideal for showcasing flooring products, wall tile collections, spatial arrangements, and brand stories. This template helps building materials brands showcase their products online and attract both renovation companies and homeowners. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYouCMS | eYouCMS...
👁 61
(PC + WAP) Black plastic sheet website template – pbootCMS website template; PC plastic sheet website source code download – 0809

(PC + WAP) Black plastic sheet website template – pbootCMS website template; PC plastic sheet website source code download – 0809 Practical Collection pbootcms Template

A PbootCMS website template designed for the black plastic sheet and PC sheet industries, supporting access on both PC and WAP devices. Its sophisticated and professional design effectively showcases the features of plastic sheet products and their engineering applications. This template helps plastic sheet manufacturers showcase their product specifications and capabilities online, enabling them to attract customers from the industrial and construction sectors. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin
👁 46
Fruit and Vegetable Orchard Picking Website Template 0515

Fruit and Vegetable Orchard Picking Website Template 0515 Practical Collection Yiyou template

This EyouCMS template is ideal for the fruit and vegetable cultivation as well as orchard picking industry. Its fresh and natural design effectively showcases fresh produce, the picking experience, the orchard environment, and the brand story. It helps agricultural picking gardens attract visitors online and expand their sales channels. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (E...
👁 47