Encode data in COMP-3 format
Prototype:
This function encode $text given in COMP-3 according with $comp3_type options (see below). The optional argument $bytes specify how many bytes must be length the converted string.
COMP-3 DEFINES
RETURN: This function returns the encode data.
<?php $text = "20080822"; $data = mfcdb_comp3encode($text, MFC_COMP3_TYPE_F, 6); echo "COMP-3, before: ".$text." - after: ".bin2hex($data)."\n"; $value = -9567; $data = mfcdb_comp3encode($value, ($value >= 0)?MFC_COMP3_TYPE_C:MFC_COMP3_TYPE_D, 8); echo "COMP-3, before: ".$value." - after: ".bin2hex($data)."\n"; ?>