![]() |
pack
How does actually this pack() function in PHP work? I'm thinking about creating a caching mechanism (DB based), to store some big objects (or arrays) collected during an application cycle lifetime. That's not important though: the PHP serialize/unserialize method has some flaws in it, meaning that for example I serialize a \n character, the resulting string will not be unserializable. So, then I thought I could pack my data in a binary form (using pack), then store it into the database. This is part of a larger test, in which the objective is to "compile" PHP code to binary code and run that instead of the interpreted PHP code.
So, where could I find some good info about pack? The info the php.net website offers is very limitative... :( Quote:
|
Quote:
I'm more intrigued as to why you think that serialize/unserialize has flaws with regards to not being able to unserialize a serialized value. Can you give an example of when this doesn't work? On the topic of compiling PHP code into some form of binary, I'm not sure of your purpose here (purely to see if you can do it, or ?). |
...and check how much faster (or slower) it is...
Here's an example with serialize/unserialize failing: PHP Code:
thanks for the links. |
Sorry but I cannot see where the serialized string is broken, can you clarify for me why you think it is broken? Unserializing that serialized string results in exactly the same array as the original one.
|
I can't find a record that doesn't work correctly right now in the db (it's late and the table has about ~5800 records). I'll just look some more over Google and see what I can find about pack...
|
| All times are GMT. The time now is 06:38 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0