The ph_encode_selector() function is a utility function for
text-based applications which need to convert field specifiers from
a string format into an array of ph_fieldselector structures.
The string argument is a text string consisting of an optional
field name and operator, as well as a mandantory value. The
requirefield argument indicates whether the field portion
of string is required.
The selectors argument is a pointer to a dynamically-allocated
array of ph_fieldselector structures. The lastindex
argument is a pointer to an integer which keeps track of the size
of the selectors array.
Successive calls to ph_encode_selector() add the selector encoded in
string to the array pointed to by selectors. Before calling
ph_encode_selector() for the first time on a given array, the caller
should initialize selectors to NULL and lastindex to 0.
The ph_free_selectors() function is used to free memory allocated
by ph_encode_selector() for the selectors array.