(PHP 3, PHP 4 )

dbase_create -- Creates a dBase database


int dbase_create ( string filename, array fields)

dbase_create() creates a dBase database in the file filename, with the fields fields.

The fields parameter is an array of arrays, each array describing the format of one field in the database. Each field consists of a name, a character indicating the field type, a length, and a precision.

The types of fields available are:


Boolean. These do not have a length or precision.


Memo. (Note that these aren't supported by PHP.) These do not have a length or precision.


Date (stored as YYYYMMDD). These do not have a length or precision.


Number. These have both a length and a precision (the number of digits after the decimal point).



注: The fieldnames are limited in length and must not exceed 10 chars, 0 < chars <= 10.

If the database is successfully created, a dbase_identifier is returned, otherwise FALSE is returned.

例子 1. Creating a dBase database file


// "database" name
$dbname = "/tmp/test.dbf";

// database "definition"
$def =
"date",     "D"),
"name",     "C",  50),
"age",      "N",   3, 0),
"email",    "C", 128),
"ismember", "L")

// creation
if (!dbase_create($dbname, $def))


虎的笑话 虎的成语 虎的歇后语