PHP code example of graze / csv-token

1. Go to this page and download the library: Download graze/csv-token library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

graze / csv-token example snippets


$csvDefinition = new CsvDefinition();
$reader = new Reader($csvDefinition, $stream);
$iterator = $reader->read();

// $stream = '"some","text",true,false,0,1,2';
$csvDefiniton = new CsvDefinition();
$parser = new Parser([new BoolValueParser(), new NumberValueParser()]);
$tokeniser = new StreamTokeniser($csvDefinition, $stream);
$iterator = $parser->parser($tokeniser->getTokens());

var_dump(iterator_to_array($iterator));
-> [['some','text',true,false,0,1,2]]