From: [EMAIL PROTECTED]
Operating system: All
PHP version: 4.0.6
PHP Bug Type: Feature/Change Request
Bug description: Reading and Writing files
Hi,
There is no fonction in PHP to read or write an integer or a long value
from a file.
Actually, I read a 2 or 4 characters string, and convert it into the
corresponding numeric value with this function :
function readNum( $f, $len )
{
$tmp = strrev( fread( $f, $len ) );
$val = 0;
for( $i=0; $i<$len; $i++ )
$val += ord(substr($tmp,$i,1)) * pow(256,$len-1-$i);
return $val;
}
Regards,
Fred.
--
Edit bug report at: http://bugs.php.net/?id=12332&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]