Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean to serialize data or an object?

using php, if possible.

What does it mean? I was reading one of my old questions ( How do you pass values between PHP pages for MVC?) and in one of the answers it says:

The part responsible for transferring the data between the controller and the view is the View engine (or class) internal to CodeIgniter. It takes that array from the controller and deserializes it for the view.

I don't know what that means (I read the comments). I put CodeIgniter as the example and tag, but I guess it could be a general question.

Thanks.

like image 428
johnny Avatar asked Dec 23 '11 22:12

johnny


People also ask

What is to serialize an object?

Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.

Why do you need to serialize data?

To wit, serialization is the process of converting a data object into a byte stream, and saving the state of the object to be stored on a disk or transmitted across a network. This cuts down the storage size needed and makes it easier to transfer information over a network.

What does it mean to serialize an object Python?

Serialization refers to the process of converting a data object (e.g., Python objects, Tensorflow models) into a format that allows us to store or transmit the data and then recreate the object when needed using the reverse process of deserialization.

What is data serialization example?

Serialization encodes objects into another format. For example you have an array in PHP like this: $array = array("a" => 1, "b" => 2, "c" => array("a" => 1, "b" => 2)); And then you want to store it in file or send to other application.


2 Answers

If you want to store your data in memory or transmit over computer network and reconstruct later in different environment, first you need to convert this data into understandable/usable format by computers which is binary format (00011010101011...).

SERIALization is a convertion of data structure into SERIES of bits.

enter image description here

like image 131
Konrad Grzyb Avatar answered Oct 02 '22 20:10

Konrad Grzyb


Serializing usually means converting object (or complex object structure) into text/binary form, suitable for storing or transmitting over network.

Deserialization is a reverse process.

like image 32
Sergio Tulentsev Avatar answered Oct 02 '22 18:10

Sergio Tulentsev