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

Write a query to find the 2nd highest salary of an employee from the employee table?

0 Answers  


Can we extend two classes in php?

0 Answers  


i'm b.com graduate and doing MCM- 1year(Master in Computer Management. i'm very interested in PHP? Please tell me some suggetion and the scope of PHP in the market. My E-mail pawan.register@gmail.com Thanks & Regards Pawan.

1 Answers  


Explain me what is the difference between $_files['userfile']['name'] and $_files['userfile']['tmp_name']?

0 Answers  


> symbol is used to redirect the output of a command. State Whether True or False?

0 Answers  






Write a php code which could be used to generate random numbers between 1 - 100 and display them on the screen.

7 Answers  


Without using forms and hidden variables, how to send variables from a PHP script to another URL using POST method?

2 Answers  


What is the difference between laravel and php?

0 Answers  


What is the use of is_array() and in_array()?

0 Answers  


What is the timeout period on session values?

0 Answers  


What is the use of friend function in php?

0 Answers  


can anyone tel me about the Expression engine Note:Its a CMS in Php

2 Answers  


Categories