From Source Peek Wiki
Reading a string block into a variable
$str_block = file_get_contents($file_path,FALSE,NULL,(($Records * $RecordSize) + 20)); // requires PHP 5.1.0
To use get your var's from the head of the file.
$_hdr_data[] = $file_name; // just a little extra info; passed to $Header
$file_format = fread($fh, 4); // be sure to fopen the file!
if($file_format == "WDBC") // is this a DBC file?
{
for($i = 0; $i < 4; $i++)
{
$bin = fread($fh, 4);
$hex = bin2hex($bin);
$hex = substr($hex, 6, 2).substr($hex, 4, 2).substr($hex, 2, 2).substr($hex, 0, 2);
$_hdr_data[] = hexdec($hex);
}
list($Header,$Records,$Fields,$RecordSize,$BlockSize) = $_hdr_data;
}