TabularData
in
Table of Contents
Methods
- fetchColumn() : Iterator<int, mixed>
- Returns a single column from the next record of the tabular data.
- getHeader() : array<string|int, string>
- Returns the header associated with the tabular data.
- getRecords() : Iterator<string|int, array<string|int, mixed>>
- Returns the tabular data records as an iterator object.
Methods
fetchColumn()
Returns a single column from the next record of the tabular data.
public
fetchColumn([string|int $index = 0 ]) : Iterator<int, mixed>
By default, if no value is supplied the first column is fetched
Parameters
- $index : string|int = 0
-
CSV column index
Tags
Return values
Iterator<int, mixed>getHeader()
Returns the header associated with the tabular data.
public
getHeader() : array<string|int, string>
The header must contain unique string or be an empty array if no header is specified.
Return values
array<string|int, string>getRecords()
Returns the tabular data records as an iterator object.
public
getRecords([array<int, string> $header = [] ]) : Iterator<string|int, array<string|int, mixed>>
Each record is represented as a simple array containing strings or null values.
If the tabular data has a header record then each record is combined to the header record and the header record is removed from the iterator.
If the tabular data is inconsistent. Missing record fields are filled with null values while extra record fields are strip from the returned object.
Parameters
- $header : array<int, string> = []
-
an optional header mapper to use instead of the tabular data header