note 49285 added to function.serialize

From: Date: Sun, 23 Jan 2005 00:33:03 +0000
Subject: note 49285 added to function.serialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-83795@lists.php.net to get a copy of this message
(please, excuse my poor English) 'serialize' does strange things with floats, this code: $a = 3.14; $s = serialize($a); $fp = fopen("storage", "w"); fwrite($fp, $s); fclose($fp); outputs something like (PHP 5.0.2): d:3.140000000000000124344978758017532527446746826171875; I wonder why serialize doesn't store data (not only float, I mean all types of data) in a more 'economic' format. Maybe binary is not the best option (there can be trouble storing it in databases), but there are still a lot of other possibilities. ---- Manual Page -- http://www.php.net/manual/en/function.serialize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49285 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49285&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49285&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49285&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49285&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49285&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49285&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83795) next »