Jump to content

Recommended Posts

hello friends...

 

i have learned about serialize(), unserialize(), __sleep(), __wakeup(),

 

but i don't get any good example to use all these together.... so that i can practically understand these all properly.... so anyone can fetch me with good example..

 

also urlencode() and urldecode()..... for what exactly these are used??? any example??

Link to comment
https://forums.phpfreaks.com/topic/279539-problem-with-saving-an-object/
Share on other sites

hello friends...

 

i have learned about serialize(), unserialize(), __sleep(), __wakeup(),

 

but i don't get any good example to use all these together.... so that i can practically understand these all properly.... so anyone can fetch me with good example..

 

also urlencode() and urldecode()..... for what exactly these are used??? any example??

 

I have an application that reads the Internet and makes "data widgets", that is, representations of things it has read.

 

Part of the application inspects these "data widgets" and assigns various bits of metadata to each one ... a "category", a "source", and so on.

 

The next step to to move these widgets from a local server to a server on the West Coast.  But rather than loop through this entire process, making a connection to the remote box each time, we pack up each "data widget" using serialize() and put it in a DB table which serves as a queue for the next step.

 

The final step reads the DB table, loops through the results, unserialize()ing them back into their original object form, and pushing them out to the West Coast server.

 

Does that help at all?  You serialize() data in order to store it more concisely (the holding queue is 3 fields, while the object itself, if stored in a database, has a few dozen fields).  You unserialize this data blob to turn it back into a usable object.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.