From:             [EMAIL PROTECTED]
Operating system: All
PHP version:      4.0.6
PHP Bug Type:     Feature/Change Request
Bug description:  Reading and Writing files

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;


Edit bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to