serialize and unserialize

I know what serialize and unserialize are where it will change array and object to the string representasion. But what is the purpose and from what I know because Arrays and objects that have been serialized mean that these arrays and objects can be stored in the database or cache which aims to maintain the data structure. Does this related to the php execution environment,Because it seems like for example : Just say the user sends data and it is received by PHP. PHP does its job until code execution ends, which means that because the code execution has ended, it is erased by memory Which causes us to not be able to maintain the data structure. Therefore, serialization is needed, whether like this or what
2 Replies
Jochem
Jochem14mo ago
serialization is just a way to turn a construct into string, its existence isn't necessarily mandatory just cause PHP runs and then stops javascript has JSON.stringify, which is also a form of serialization you can store data without using a built-in method of serializing it too
Abrar
AbrarOP14mo ago
Thanks for the explanation sir
Want results from more Discord servers?
Add your server