I'm trying to load a text file into a MySQL table. The text file has 2 delimiters (tab and space). The problem is that some of the fields in the text file occasionally have NULL values. When this happens, and I split (preg_split or split) the file out into an array in PHP, instead of producing elements in the array containing NULL values, those elements are dropped. The result is a PHP array with an inconsistent field layout.

Can anyone suggest a solution?

Thanks very much.


My mistake - the empty elements were dropped previous to the text file. Explanation for this being that the source is a syslog.