Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel import data from csv

function csvToArray($filename = '', $delimiter = ',')
{
    if (!file_exists($filename) || !is_readable($filename))
        return false;

    $header = null;
    $data = array();
    if (($handle = fopen($filename, 'r')) !== false)
    {
        while (($row = fgetcsv($handle, 1000, $delimiter)) !== false)
        {
            if (!$header)
                $header = $row;
            else
                $data[] = array_combine($header, $row);
        }
        fclose($handle);
    }

    return $data;
}
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress options 
Php :: php extract number from string without comma 
Php :: random string number generator in php codeigniter 
Php :: laravel project make 
Php :: Get All dates of a month with laravel carbon 
Php :: constants in php 
Php :: spaceship operator php 
Php :: woocommerce_variation_option_name on frontend 
Php :: PHP DateTime Format date time according to a time zone 
Php :: php include multiple files at once 
Php :: bootstrap is not defined in laravel 
Php :: how to trim text php 
Php :: in arrray php 
Php :: laravel pivot table model 
Php :: laravel composer create project 
Php :: CHECKING IF FILE IS EMPTY IN PHP 
Php :: how to run php in js 
Php :: wordpress change slug programmatically 
Php :: php prepared statements 
Php :: simple pagination in php 
Php :: doctrine getrepository findby 
Php :: php buffer 
Php :: check php-fpm version ubuntu 
Php :: how to create a php website 
Php :: match uuid patter laravel regex 
Php :: Eager realationship in laravel 
Php :: trova corrispondenza nella stringa php 
Php :: download pdf file from database in php 
Php :: php namespaces 
Php :: app url laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =