PHP code example of colbygatte / csv

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

    

colbygatte / csv example snippets



# data.csv:
# state,location
# Louisiana,south
# "New York",north
foreach (csv_sip('data.csv') as $row) {
    # Access row data using that column's header
    if ($row->location == 'south') {
        echo "Hey, y'all! {$row->state} is awesome!";
    } else {
        echo "I don't know much about {$row->state}.";
    }
}