What is serialization / object serialization ?

Answers were Sorted based on User's Feedback



What is serialization / object serialization ?..

Answer / sloog

Serializing an object means converting it to a bytestream
representation that can be stored in a file. This is useful
for persistent data; for example, PHP sessions automatically
save and restore objects. Serializatioin in PHP is
mostly automatic--it requires little extra work from you,
beyond calling the serialize() and unserialize() functions:

$encoded = serialize(something);
$something - unserialize(encoded);

Is This Answer Correct ?    4 Yes 0 No

What is serialization / object serialization ?..

Answer / ranjan

Say we have some information in the form of object or array
and we want to store that into database then we should
serialize that and then we can store the returned string in
the database. While accessing we will have to unserialize that.

Also if we want to play with the string before we store the
above string into the database then we need to use it
everytime by unserializing it.

We can avoid this if we register this iobject with the
session and then nsession will automatically unserialize it
and we need not to unserialize it before playing or while
storing

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More PHP Interview Questions

Does php class need constructor?

1 Answers  


How can we determine whether a variable is set?

1 Answers  


Do you have to initialize variables in php?

1 Answers  


Where is session id stored?

1 Answers  


How many ways I can redirect a PHP page?

9 Answers   MicroSec, N-Tier Business Solutions, University Exams,


i got this error msg in online... how to solve this problem... i couldnot find out as soon as possible send me answer or idea COULD NOT ABLE TO CONNECT DATABASE . Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)

3 Answers   Quest,


What is the difference between explode and split?

1 Answers  


What is the use of php and mysql?

1 Answers  


How can you get the size of an image in PHP?

1 Answers  


Is null or empty c#?

1 Answers  


What is the difference between $message and $$message ?

7 Answers   Oracle, TouchStone,


What is the use of session and cookies in php?

1 Answers  


Categories