note 92203 deleted from function.fread by danbrown

From: Date: Tue, 14 Jul 2009 13:26:20 +0000
Subject: note 92203 deleted from function.fread by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158268@lists.php.net to get a copy of this message
Note Submitter: sica at wnet com br ---- Binary file problem: I'd like to save some float values on file and read it. <?php //PHP Version 5.2.6-3 $valor = 12.5; settype($valor,"float"); //… writing … $ptrarq = fopen("./teste.bin", "wb"); fwrite($ptrarq, $valor); fclose($ptrarq); //... reading … $ptrarq = fopen("./teste.bin", "rb"); $valor = fread($ptrarq,filesize("./teste.bin")); fclose($ptrarq); echo gettype($valor); // it print "string" ?> Why we cannot to get well a "float" or "double" value?

« previous php.notes (#158268) next »