summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class11
1 files changed, 10 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 5e89123..43239b0 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -141,7 +141,16 @@ function cols($collist, $separator = "\t")
{
$keys = explode(",", $collist);
foreach ($this->lines as $idx => $line)
- $this->lines[$idx] = (object)array_combine($keys, explode($separator, $line));
+ {
+ if (count($keys) == count($arr = explode($separator, $line)))
+ $this->lines[$idx] = (object)array_combine($keys, $arr);
+ else
+ {
+ unset($this->lines[$idx]);
+ foreach ($keys as $i => $key)
+ $this->lines[$idx]->$key = $arr[$i];
+ }
+ }
return $this;
}