WooParc_array2csv

Create CSV from array.

Description

WooParc_array2csv( array &$array ); 

Parameters (1)

0. $array
The array.

Usage

  1. if ( !function_exists( 'WooParc_array2csv' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-postnl-parcelware/inc/funct-export.php'; 
  3.  
  4. // The array. 
  5. $array = array &$array; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = WooParc_array2csv($array); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/funct-export.php  
  1. function WooParc_array2csv(array &$array) { 
  2. if (count($array) == 0) { 
  3. return null; 
  4. ob_start(); 
  5. $df = fopen("php://output", 'w'); 
  6. fputcsv($df, array_keys(reset($array))); 
  7. foreach ($array as $row) { 
  8. fputcsv($df, $row); 
  9. fclose($df); 
  10. return ob_get_clean();