
06-13-2007, 01:07 PM
|
|
Script-fu
|
 |
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
|
|
|
Ideally your serialised string will have no bias towards certain characters. Like Novo said, your script will probably break if a string is used that contains the : character. It's safe to assume that variable names won't contain colons, so that makes it easier to process variable names, however the script needs to more reliably read the value.
The way that PHP does it is that your serialised string not only has the name and value of the object, but it also has a length value for the value. That way, you do not have to depend upon the positions of : characters.
An example:
foo:3:b:r:bar:4:ZOOM
... This would make a variable "foo" with the value "b:r", and another called "bar" with the value "ZOOM", because it's been instructed to read the 3 characters following the first instruction, and 4 characters for the second one, regardless of the position of colons in the string. |
__________________
|
|
|
|