Skip to content

Instantly share code, notes, and snippets.

@MrZANO
MrZANO / jsonToCsv.php
Created June 13, 2018 13:36 — forked from jakebathman/jsonToCsv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure