PHP code example of zebba / loader

1. Go to this page and download the library: Download zebba/loader 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/ */

    

zebba / loader example snippets

 php


$csv = "key1;key2\r\nvalue1;2\r\nvalue2;3";

// $csv = new \SplFileInfo(...);

try {
	$output = Csv::parse($csv);
} catch (\Zebba\Component\Loader\Exception\ParseException $e) {
	throw $e;
}	

/*
 * $output = array(
 * 	array(
 *		'key1' => 'value1',
 *      'key2' => 2,
 *	), array(
 *   	key1' => 'value2',
 *      'key2' => 3,
 *	)
 * );
*/

 php




$input = array(
	array(
    	'key1' => 'value1',
        'key2' => 2,
	), array(
    	'key1' => 'value2',
        'key2' => 3,
	)
);

$csv = Csv::dump($input);

// $csv = "key1;key2\r\nvalue1;2\r\nvalue2;3";