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 :: multi line dot match php 
Php :: current tab active on page reload in php 
Php :: php exponential equation 
Php :: ci4+ connection code 
Php :: Redirect file.php to file with .htaccess | Redirect to its non .php version 
Php :: laravel view 
Php :: woocommerce_default_catalog_orderby desc 
Php :: search posts by post title in worpress 
Php :: pivot null in livewire refresh 
Php :: codeigniter remote queries very slow 
Php :: acf if image else display other image 
Php :: length shorter 
Php :: api key for getting youtube channel videos in php 
Php :: laravel change error page to open in vscode 
Php :: andebol 
Php :: date + 14 days php 
Php :: Laravel eloquent mass assignments 
Php :: cakephp Not Found error handle in pagination 
Php :: How to add page heading in FPDF PHP 
Php :: FT_USER 
Php :: how to check php version in cpanel 
Php :: php zoom api start_time issue 
Php :: Route::any 
Php :: php runden auf 2 stellen 
Php :: php array merge 
Php :: dump request in ci 
Php :: redaxo urlgenerator 
Php :: rendomly mix array position in php 
Php :: wc php get currency symbol 
Php :: php tableaux 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =