View Single Post
06-14-2009, 10:25 PM
Join Date: Apr 2007
Originally Posted by
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
or you can look at the
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 ?).
View Public Profile
Send a private message to Salathe
Visit Salathe's homepage!
Find More Posts by Salathe