src/ShapeFile.php
private function _loadDBFHeader()
    {
        $DBFFile = fopen($this->_getFilename('.dbf'), 'r');

        $result = [];
        $i = 1;
        $inHeader = true;

        while ($inHeader) {
            if (! feof($DBFFile)) {
                $buff32 = fread($DBFFile, 32);
                if ($i > 1) {
                    if (substr($buff32, 0, 1) == chr(13)) {
                        $inHeader = false;
                    } else {
                        $pos = strpos(substr($buff32, 0, 10), chr(0));
                        $pos = ($pos == 0 ? 10 : $pos);

                        $fieldName = substr($buff32, 0, $pos);
                        $fieldType = substr($buff32, 11, 1);
                        $fieldLen = ord(substr($buff32, 16, 1));
                        $fieldDec = ord(substr($buff32, 17, 1));

                        array_push($result, [$fieldName, $fieldType, $fieldLen, $fieldDec]);
                    }
                }
                ++$i;
            } else {
                $inHeader = false;
            }
        }

        fclose($DBFFile);

        return $result;
    }
private function _loadDBFHeader()
    {
        $DBFFile = fopen($this->_getFilename('.dbf'), 'r');

        $result = [];
        $i = 1;
        $inHeader = true;

        while ($inHeader) {
            if (! feof($DBFFile)) {
                $buff32 = fread($DBFFile, 32);
                if ($i > 1) {
                    if (substr($buff32, 0, 1) == chr(13)) {
                        $inHeader = false;
                    } else {
                        $pos = strpos(substr($buff32, 0, 10), chr(0));
                        $pos = ($pos == 0 ? 10 : $pos);

                        $fieldName = substr($buff32, 0, $pos);
                        $fieldType = substr($buff32, 11, 1);
                        $fieldLen = ord(substr($buff32, 16, 1));
                        $fieldDec = ord(substr($buff32, 17, 1));

                        array_push($result, [$fieldName, $fieldType, $fieldLen, $fieldDec]);
                    }
                }
                ++$i;
            } else {
                $inHeader = false;
            }
        }

        fclose($DBFFile);

        return $result;
    }
private function _loadDBFHeader ( ) { $ DBFFile = fopen ( $ this -> _getFilename ( '.dbf' ) , 'r' ) ; $ result = [ ] ; $ i = 1 ; $ inHeader = true ; while ( $ inHeader ) { if ( ! feof ( $ DBFFile ) ) { $ buff32 = fread ( $ DBFFile , 32 ) ; if ( $ i > 1 ) { if ( substr ( $ buff32 , 0 , 1 ) == chr ( 13 ) ) { $ inHeader = false ; } else { $ pos = strpos ( substr ( $ buff32 , 0 , 10 ) , chr ( 0 ) ) ; $ pos = ( $ pos == 0 ? 10 : $ pos ) ; $ fieldName = substr ( $ buff32 , 0 , $ pos ) ; $ fieldType = substr ( $ buff32 , 11 , 1 ) ; $ fieldLen = ord ( substr ( $ buff32 , 16 , 1 ) ) ; $ fieldDec = ord ( substr ( $ buff32 , 17 , 1 ) ) ; array_push ( $ result , [ $ fieldName , $ fieldType , $ fieldLen , $ fieldDec ] ) ; } } ++ $ i ; } else { $ inHeader = false ; } } fclose ( $ DBFFile ) ; return $ result ; }
Loads DBF metadata.
Loads DBF metadata .