pg_field_num() will return the number of the column (field) slot that corresponds to the field_name in the given PostgreSQL result resource. Field numbering starts at 0. This function will return -1 on error.
Nota: This function used to be called pg_fieldnum().
See also pg_field_name().