PHP code example of niiyz / csv

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

    

niiyz / csv example snippets

 php
      
      z\Csv\CsvDownload;
  
      $list = [];
      $list[] = ["山田太郎", 12, 165, 50];
      $list[] = ["島田ジョン", 11, 175, 67];
      $list[] = ["小泉今日子", 48, 155, 45];
      
      $header = ["名前", "年齢", "身長", "体重"];
      
      $csv = new CsvDownload($list, $header);
      $csv->convertEncoding('UTF-8', 'SJIS-win');
      $csv->download('list.csv');