csv to json php
<?php
//Open our CSV file using the fopen function.
$fh = fopen("names.csv", "r");
//Setup a PHP array to hold our CSV rows.
$csvData = array();
//Loop through the rows in our CSV file and add them to
//the PHP array that we created above.
while (($row = fgetcsv($fh, 0, ",")) !== FALSE) {
$csvData[] = $row;
}
//Finally, encode our array into a JSON string format so that we can print it out.
echo json_encode($csvData);
Also in PHP:
- apt install php7.4-mbstring php7.4-zip php7.4-xml
- express get current url
- Class 'PHPUnit_Framework_TestCase' not found in vendor
- artisan route:list
- PHP header(refresh)
- avoir la date php
- current date() in php
- disable timestamp laravel
- How to display MySQL data dynamically using jQuery and PHP
- datetime format laravel
- console.log. php print
- create table seeder laravel
- convert time to string in php
- file_get_contents openssl error
- current datetime php
- can i throw exception in catch block php
- check if substring php
- Str::random() example
- check object type php
- binary base64 decode php
- corsair k70 rgb mk.2
- cronjob cakephp
- days to date php
- Woocommerce custom Flat Rate charges (by ID) Function