/** Writes a DBF file to the provided location {@link $filename}, with a given * {@link $schema} containing the DBF formatted <code>$records</code> * marked with the 'last updated' mark <code>$date</code> or a current timestamp if last * update is not provided. * @see DBF * @param string $filename a writable path to place the DBF * @param array $schema an array containing DBF field specifications for each * field in the DBF file (see <code>class DBF</code documentation) * @param array $records an array of fields given in the same order as the * field specifications given in the schema * @param $ismemodata A boolean to check if the query executed contains memo field in it. * @param $memoheaders A collection of the details for writing the memo FPT file. Required if $ismemodata is true * @param array $date an array matching the return structure of <code>getdate()</code> * or null to use the current timestamp. This is optional. */ public static function write($filename, array $schema, array $records, $ismemodata = null, $memoheaders = null, $date = null) { self::$lastBlockNo = 512 / self::$blockSize; self::$DBFFileName = $filename; if (!$ismemodata) { file_put_contents(self::$DBFFileName, self::getBinary($schema, $records, $date, $ismemodata)); } else { $DBFPathInfo = pathinfo($filename); self::$FPTFileName = $DBFPathInfo['dirname'] . '/' . str_ireplace('.dbf', '', $DBFPathInfo['basename']) . '.fpt'; self::writeMemoHeaders($memoheaders); file_put_contents(self::$DBFFileName, self::getBinary($schema, $records, $date, $ismemodata)); } }