diff options
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class index f1cdf76..36e4f63 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -132,11 +132,16 @@ function ED() return $this; } -function cols($collist) +/** + * Convert every line into an object with named columns + * @param collist comma separator column name list + * @param separator split character ["\t"] + */ +function cols($collist, $separator = "\t") { $keys = explode(",", $collist); foreach ($this->lines as $idx => $line) - $this->lines[$idx] = (object)array_combine($keys, explode("\t", $line)); + $this->lines[$idx] = (object)array_combine($keys, explode($separator, $line)); return $this; } |