Private/Polyfony/Format.php
public static function csv(array $array, string $separator = "\t", string $encapsulate_cells = '"') :string {

		// declare our csv
		$csv = '';
		// for each line of the array
		foreach($array as $cells) {
			// for each cell of that line
			foreach($cells as $cell) {
				// protect the cell's value, encapsulate it, and separate it,
				$csv .= $encapsulate_cells . str_replace($encapsulate_cells, '\\'.$encapsulate_cells, $cell) . $encapsulate_cells . $separator;
			}
			// skip to the next line
			$csv .= "\n";
		}
		// return the formatted csv
		return $csv;

	}
public static function csv(array $array, string $separator = "\t", string $encapsulate_cells = '"') :string {

		// declare our csv
		$csv = '';
		// for each line of the array
		foreach($array as $cells) {
			// for each cell of that line
			foreach($cells as $cell) {
				// protect the cell's value, encapsulate it, and separate it,
				$csv .= $encapsulate_cells . str_replace($encapsulate_cells, '\\'.$encapsulate_cells, $cell) . $encapsulate_cells . $separator;
			}
			// skip to the next line
			$csv .= "\n";
		}
		// return the formatted csv
		return $csv;

	}
public static function csv ( array $ array , string $ separator = "\t" , string $ encapsulate_cells = '"' ) : string { // declare our csv $ csv = '' ; // for each line of the array foreach ( $ array as $ cells ) { // for each cell of that line foreach ( $ cells as $ cell ) { // protect the cell's value, encapsulate it, and separate it, $ csv .= $ encapsulate_cells . str_replace ( $ encapsulate_cells , '\\' . $ encapsulate_cells , $ cell ) . $ encapsulate_cells . $ separator ; } // skip to the next line $ csv .= "\n" ; } // return the formatted csv return $ csv ; }
convert an array to a csv
convert an array to a csv