-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introducing the Buffer instance (#554)
Introducing the Buffer instance
- Loading branch information
Showing
26 changed files
with
1,954 additions
and
593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,30 @@ $exists = $resultSet->exists(fn (array $records) => in_array('twenty-five', $rec | |
|
||
## Selecting columns | ||
|
||
### fetchColumn | ||
|
||
The `fetchColumn` returns an Iterator containing all the values of a single column specified by its | ||
header offset if you provide an integer or its header name if you provide a string name that exists. | ||
|
||
```php | ||
$reader = Reader::createFromPath('/path/to/my/file.csv'); | ||
$reader->setHeaderOffset(0); | ||
$records = (new Statement())->process($reader); | ||
foreach ($records->fetchColumn(3) as $value) { | ||
//$value is a string representing the value | ||
//of a given record for the selected column | ||
//$value may be equal to '[email protected]' | ||
} | ||
|
||
foreach ($records->fetchColumn('3') as $value) { | ||
//$value is a string representing the value | ||
//of a given record for the selected column whose name is '3' | ||
//$value may be equal to '[email protected]' | ||
} | ||
``` | ||
|
||
Two additional methods are added to ease distinguish usage | ||
|
||
### fetchColumnByName | ||
|
||
The `fetchColumnByName` returns an Iterator containing all the values of a single column specified by its header name if it exists. | ||
|
Oops, something went wrong.