(Using php 5.5)
Values of constant field type appears to be inconsistent. Dumping values will show you integer values, including information retrived by px_get_field for type. Field specification in px_create_fp demands to be a char value, because number will be resolved as unknown types. Here is a list with value for each field type that actually works:
ALPHANUMERIC = A
DATE = D
SHORT INTEGER = D
LONG INTEGER = I
CURRENCY = $
NUMBER = N
DOUBLE = N
LOGICAL = L
BOOLEAN = L
MEMOBLOB = M
BLOG = B
FMTMEMOBLOB = F
OLE = O
GRAPHIC = G
TIME = T
TIMESTAMP = @
AUTOINC = +
BCD = #
BYTES = Y
<?php
$fields = array();
$id = array('id', '+'); // Field name = id, type = autoinc
$name = array('name', 'A', 80); // Field name = name, type = alpha, length = 80
array_push($fields, $id);
array_push($fields, $name);
if(!$pxdoc = px_new()) {
/* Error handling */
}
$fp = fopen("test.db", "w+");
if(!px_create_fp($pxdoc, $fp, $fields)) {
/* Error handling */
}
px_close($pxdoc);
px_delete($pxdoc);
fclose($fp);
?>
And that should do the job!