06-14-2009, 11:25 PM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,324
Thanks: 5
|
Quote:
Originally Posted by xenon
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... :(
|
pack simply takes a formatting string and any number of other arguments to be packed into the binary string result. Of course, that's not much of an explanation! A little bit more information, though not a lot, can be found here or you can look at the Perl pack for comparison (though it is not 100% identical).
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 ?).
|
|
|
|