If you want to save space in your serialized data of floating point numbers in PHP, consider to use PHP 4. Naturally that is a joke :), I just note it down here because while taking a closer look on the is_serialized() function again (#9930, #14429) I ran over a difference between PHP 4 and PHP 5.
Example
A double value encoded in the PHP file as 1e99
which is in interpreted as float(1.0E+99)
is serialized in PHP 4 as string(25) "d:1.0000000000000046E+99;"
where as PHP 5 prefers string(102) "d:99999999999999996733...62608739868455469056;"
. Both unserialize back to float(1.0E+99)
. And both PHP versions can unserialize the value of the other version (with some differences on the value naturally as this is floating point which has limited precision and it does so as well when not switching PHP versions).
The whole is_serialized() topic got some traction lately after Rasmus Lerdorf threw strpbrk() onto it in some of his PHP Performance talks.
Pingback: PHP Serialize does References | hakre on wordpress