Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

explode , implode , is_array , in_array , array_diff , array_diff_key count

JSON

json_decode , json_encode

...

Code Block
/*
Generate a CSV in the OUTBOUND directory 
named 'MY-OUTBOUND-FILE.csv' with the following content:

      a, b, c, 1, 2, 3
      d, e, f, 4, 5, 6
*/

$csvRows$array = [];
$csvRows[] = $this->arrayToCsv(['a', 'b', 'c', 1, 2, 3]);,
$csvRows[] = $this->arrayToCsv(['d', 'e', 'f', 4, 5, 6]
];
$csv = $this->arrayToCsv($array);
createFile Function
Code Block
$bytesWritten = $this->createFile('MY-OUTBOUND-FILE.csv', $csv $csvRows, 'OUTBOUND', true);

if ($bytesWritten === false) {
  // There was an error creating the file, handle that here
  // Check the error log for more details
} else {
  // The file was created successfully $bytesWritten will be the number of bytes written
}

...